KFM & Applications

KFM and KPanel use a common way of managing applications. For every application one should have at least one file in the directory tree $KDEDIR/apps. This tree is the same that makes up the KPanel start menu. The files in this directory tree are KConfig files. Using them you can do several things

Lets have a look at an example:

[KDE Desktop Entry]
Type=Application
Exec=netscape %u
Icon=netscape3.xpm
TerminalOptions=
Path=
Terminal=0
BinaryPattern=netscape;Netscape;
Comment=Netscape Internet Browser

[Binding]
Protocols=file;ftp;http;
Extensions=HTML;

The first line is a must. The second one tells us about the type of this file. The third one tells us how to start the application. You may place the variables %u %f %n %d in this line and the line may consist of several commands separated by ';' like your shell does. The variables may appear several times in the string. They have the following meaning

%u
The complete URL of the file
%f
The normal file name. This will only work for files on the local file system.
%d
The parent directory. If the given argument is a file ( not a directory ) then this will give you the directory this file is in.
%n
The name of the file. If the given argument is a directory then this is the name of this directory.

Icon tells the which icon to use. This is the icon that you will see in KFM as representation for this file and in KPanel if you put this file on the panel. If you mention a binary pattern then the binary itself will get this icon in KFM. Pattern means that all files matching this pattern will get the icon. The icon must reside in $KDEDIR/lib/pics. TerminalOptions may be any option that your terminal program understands. Path is the path in which to execute the binary, the so called working directory. Setting Terminal to some value differnt from 0 you can tell KFM to start the binary in an terminal window. With Comment you can give some explanation about the application. If the user has the mouse over the application if KFM he will get this comment in the right corner of the status bar.

Using the Binding entry is optional. You can tell here which protcols your application understands. Separate the protocols with ';' and make shure that you terminate the line with ';'. After doing so you must tell KFM which kind of documents your application can understand. Document formats are described elsewhere in their special files. You must know the filename that describes the document, strip off the ".kdelnk" and you have a valid entry for this line. Our example application only understands documents of type HTML. You can enter some exclusive specials here. ALLFILES binds the application to all files with the required protocol. ALL binds it to all files and directories and ALLDIRS binds it to all directories.

Note that it does not matter for KFM where in the directory tree it finds the application file. And it does not matter where in the filetypes directory tree the referenced document type is. Never use path names in the Extensions line.

Read the section about file types to learn how a pattern may look like.


Torben Weis weis@kde.org, weis@stud.uni-frankfurt.de