How To Make KDE Run Gambas Executables Automatically

Note: $YOURKDE is the installation directory of KDE in your system. In my Slackware 10.0 it is /opt/kde. To know yours just type in a console:
$ kde-config --prefix.

1. Creates a MIME type for Gambas executable

Create the text file $YOURKDE/share/mimelnk/application/x-gambas.desktop.

Open it and add these lines:

[Desktop Entry]
Encoding=UTF-8
Comment=Gambas executable
Icon=binary
Type=MimeType
MimeType=application/x-gambas

2. Creates a desktop file for the interpreter

Creates the text file $YOURKDE/share/applnk/.hidden/gbr2.desktop. Notice the dot before hidden.

Open it and add these lines:

[Desktop Entry]
Exec=gbr2
InitialPreference=1
MimeType=application/x-gambas
Name=gbr2
Terminal=false
Type=Application

3. Adds Gambas executables description to the KDE magic file

The next file already exists!!! You just have to edit it... Be careful!

Edit the file $YOURKDE/share/mimelnk/magic and add this line:
0      string     #!/usr/bin/gbr3    application/x-gambas

That's all.

Restart your kde session. The Gambas executables will have the generic icon "binary" and you will be able to run them by just clicking on them.

Adapted from a mail of Stefano Palmeri