Installing new mime types step by step

This chapter could be named installing mime types for dummies since it comes with many nice pictures :-).

In the following we want to see how I installed the image/gif mime type. You dont need to reproduce these steps, since this mime type is already installed. After reading this chapter and after having a look at all the images you should know how to install new ones.

The black numbers on yellow circels in the images correspond to the numbered list under the image.

Open a KFM super user window

On your desktop you will find icons like these:

Now click on this icon to open a new KFM window. Usually this is the correct method, but in some cases we need a super users KFM window. If you want to edit the global config files which are usually only writeable for the super user, you need super user access. If you dont now the super user password, then you are not allowed to change the global configuration anyway, but you can of course edit your user specific configuration without being super user. There are different methods leading to a super user kfm window. You can log out, and log in as root. That is the Windows NT way, so we want to do it better. You could open a kvt window, switch to superuser with su and start kfm -ws now, but it is much easier to hit Alt+F2. Now enter kfmsu. A terminal window pops up, asking you for super users password. Enter it and a KFM window will popup up. Once you have done the following stuff, dont forget to close the KFM super user window again. At this time the terminal will desappear, too. the kfmsu script will allow the super user to access the display and will disallow it afterwards automatically for you.

To start, click once with the left mouse button on Templates folder ( or open a super user KFM window as described above ). Have a look at the files in this directory, you will remember them later in this chapter.

Now open the menu Edit and choose Mime Types ( or Global Mime Types if you want to edit the global configuration ). Now you will see something like this:


  1. This is the magic file we talked about before. You should have a look at it later, but dont worry, no need to understand it.
  2. The folder containing the image/gif mime type file. Click on this folder with the left mouse button to open it.

Creating a new mime type file

Open the menu File and select New. You may have notice by now that the names in this popup menu correspond to the names in the tamplates folder. This menu gives you quick access to the templates. You can have the same effect by opening the templates folder and doing drag and drop. Now select Mime Type. A window like this one will popup:


  1. Enter the name of the file here. Please dont delete the .kdelnk extension. You should notice here that the name of the file is only the second part of the mime types name. The first part is coverd by the directory you move the file in. The name of the file and the subdirectory you put it in does not really matter, it just needs to be in $KDEDIR/share/mimelnk.
  2. Now press the OK button and the new icon will appear in the KFM window.

Opening the properties dialog

Now press the right mouse button over the new icon and select Properties from the popup menu. A dialog appears:


  1. Select the tab called Binding.
  2. Enter some patterns that usually match files of this data type. If you have multiple patterns, then you must separate them with a ;
  3. Enter a descriptive text here. If your language is supported, you will notice that the description is in your native language. KFM can store multiple descriptions, one for each language. If you enter something here then it will be stored under your language. Application developers should make shure that at least a english description is available. How to do this was discussed one chapter before in the hackers section.
  4. Enter the full name of the mime type.
  5. You can select a default application here. This is of interest if multiple applications regsitered for the same mime type. If you click on such a data type file KFM makes a guess which app to use. By choosing a default app you can keep KFM away from guessing.
  6. Select a icon. All icons are stored in $KDEDIR/share/icons. For every icon in this directory there exists a icon of the same name but half size in $KDEDIR/share/icons/mini. Usual icons have the size 32x32 and the mini icons 16x16.
  7. Press the OK button.

Now KFM rescans all opened directories because the icons and stuff could have changed. You can force KFM manually to do so by choosing Rescan Bindings in the View menu. Your mime type is now registered and KFM should know about it.

Congratulations, you survived this lesson. Time for a break now :-)