Users can create shortcuts for an application to appear in menus, desktop, etc. by creating a .desktop file. This desktop file contains a listings of configuration for the application. In order for your desktop environment to "see" this file, this .desktop file will have to be placed either in /usr/share/applications - for system wide applications - or in ~/.local/share/applications - if the application should be available for a single user
Once the file is placed in this location the desktop uses this file to:
- put the application in the .
- list the application in the Run Application... dialog
- create appropriate launchers in the menu or on the desktop.
- associate the name and description of the application.
- use the appropriate icon.
- recognize the MIME types it supports for opening files.
Here's an example of a desktop file I have created for tinyCA application. I am running Debian Jessie and this application does not come with a any menu entries or desktop shortcut.
$ cat ~/.local/share/applications/tinyca2.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=TinyCA Certificate Authority
NoDisplay=false
Categories=Network;
Icon=security-low
Exec=/usr/bin/tinyca2
Terminal=false
Comment=TinyCA2 certificate authority
The entries one by one:
[Desktop Entry] - identifies the group name to which the desktop entry belongs. A group is name is enclosed in [ ] and there can be more than one group in a desktop file. [Desktop Entry] group is required by the basic desktop file entry
Version - version of the desktop entry specification. This field is not required
Type - type of the entry. At this time the options are Application, Link and Directory
Name - specific name of the application
NoDisplay - specifies if the files is to be displayed in the menus, desktop search, etc
Categories - from here the system derives the placement of the application in the menu (eg. my file tinyCA will appear under the Internet menu directory). To find a list of valid categories, take a look into FreeDesktop.org's Desktop Menu Specification - Categories and Additional Categories.
Icon - Icon to display in the menus, file manager, deskop, etc. Important is that if using a new icon you have to install (copy) it to the theme your desktop environment is using. I am using the Adwaita theme, so the desktop looks in the icons directory of Adwaita - /usr/share/icons/Adwaita/. The security-low image used is part of this theme.
Exec - Program to execute and possible arguments.
Terminal - whether the program runs in a terminal window
Comment - Tooltip for the entry
To see the full desktop entry specification you can go to desktop entry specification GNOME page.
Graphical users interfaces that can be used to edit menus are alacarte (GNOME) or menulibre. Below a screenshot from menulibre.
While this post has focused on Gnome desktop environment all is applicable as well to other FreeFesktop.org compliant desktop.
No comments:
Post a Comment