Table of Contents
15.2 Class DesktopFile (gb. desktop)
This class is still under development. You can use this class to create and edit the so-called “desktop entries” as desktop configuration files (application/x-desktop) later on. These configuration files describe, for example, how a program is started or how a program appears in a menu. Some distributions have menu editors, others - like Lubuntu - do not have them. Obviously, the DesktopFile class has therefore been included in the gb. desktop component.
However, you can already get the exact specification of files for desktop entries under the link: http://standards.freedesktop.org/desktop-entry-spec/latest/ in the current version because Gambas follows this specification.
15.2.1 Format of a configuration file
A desktop configuration file consists of the following elements:
- Comments - A comment line begins with the # character
- Group sections - A group name is enclosed by square brackets. The group name is followed by a list of key-value pairs
- Lists of key-value pairs - A key-value pair consists of a (standardized) keyword followed by an equal sign. Some keys are required, others are optional.
15.2.2 Example of a configuration file:
# # Starter für die IDE von Gambas 3 # Pfad: ~/.local/share/applications/gambas341.desktop # [Desktop Entry] # Erforderliche Einträge Type=Application Name=Gambas 3.4.1 Exec=/usr/bin/gambas3 # Optionale Einträge Icon=/home/hans/gb341/app/src/gambas3/img/logo/logo-64.png Categories=Development Comment=Start der GAMBAS-IDE Version=3.4.1 Terminal=false
You can write the above lines with an editor of your choice and save the file in the user directory:
~/.local/share/applications/gambas341.desktop
to save them. No root privileges are required. However, if the desktop configuration file is to be system-wide, it must be saved in the following directory with root privileges:
/usr/share/applications/gambas341.desktop
After saving you will see the sub-menu 'Gambas 341' in the' Software development' section of the applications menu.
If you also want the starter to be visible on your desktop, you also need to copy the desktop configuration file to the ~/Workspace directory under Ubuntu 12.04. The configuration file must be copied to the directory ~/Workspace under Ubuntu 12.04 as well. You should change the name in the properties of the configuration file to a short form like 'GB 3.4.1' and make the file executable under Ubuntu!
It remains to be seen when this class is released for use.
