FreeDesktop.org Integration
From PsiWiki
Contents |
Current Status
We've all noticed that Psi checks for KDE on "make install". This happens because Psi installs a special .desktop file describing the application, only if it detects KDE.
The .desktop file has become a standard for describing applications, mime-types, menus described on freedesktop.org
This means Psi needs to install the .desktop file no matter if KDE is installed or not.
Prerequisites
There are 4 specs (until now) which need to concur to make a perfect desktop integration:
- desktop-entry spec - describes the contents of the .desktop file (the key-value entries)
- menu spec - lists the registered categories an application can be added to
- icon-theme spec - describes where the application icons should be placed
- startup-notification spec - describes interaction between the application and the desktop during startup
Implementation
Support detection
I am not sure yet wether to include freedesktop.org detection or not, for the Linux version. Detection would be useful though considering that there might be *nixes (as in distributions) not compatible with the FreeDesktop.org specifications. The major desktops (KDE, GNOME, XFCE - from what I'm aware) support the freedesktop.org specifications.
FreeDesktop.org provides a package with tools, desktop-file-utils, containing desktop-file-install, a program designed to help installing .desktop files into the system.
I believe that we could consider looking for desktop-file-install as a method for checking support for FreeDesktop.org support.
The XDG internals
Once FreeDesktop.org support is detected desktop-file-install would be used as following:
desktop-file-install --vendor=psi psi.desktop
This command will place psi.desktop in a directory, in our case $XDG_DATA_DIRS/applications (only the first dir in $XDG_DATA_DIRS will be used - I think).
According to the base-dir spec, $XDG_DATA_DIRS is a list of directories where data resides. If the variable is empty, "/usr/local/share:/usr/share" would be considered the default.
Therefore, it is safe to assume that the list in $XDG_DATA_DIRS would at least contain "$PREFIX/share". We use desktop-file-install to install psi.desktop but we don't have any program to install the icons, we only have specs. We will use this assumption when installing icons.
psi.desktop
An updated psi.desktop file follows
# This file complies to # http://standards.freedesktop.org/desktop-entry-spec ver, 0.9.4+ # http://www.freedesktop.org/Standards/menu-spec ver. 0.9+ [Desktop Entry] Type=Application Version=0.9.4 Encoding=UTF-8 Name=Psi GenericName=Jabber Client Comment=Psi Jabber Client Icon=psi.png TryExec=psi Exec=psi -caption "%c" %i %m Terminal=false Categories=Qt;Network;InstantMessaging; StartupNotify=true StartupWMClass=psi
- The key-value entries are listed as they are given in the desktop-file-spec.
- The categories are selected from the Registered Categories listing, in the menu-spec.
- StartupNotify/StartupWMClass is assumed to be working. We need to check wether Psi complies to the startup-notification-spec
A list of internationalized GenericName/Comment pairs for the psi.desktop file is mainainted on the Desktop Translations page.
Icons
The icons should be installed no matter if the FreeDeskop.org specs are met or not.
The latest icon-theme-spec says that there is a default icon theme which is used when the current theme does not have an icon suited for your application.
The default theme (named hicolor), available here, also installable via a package in the Linux distributions, contains the hierarchy in which application icons should keep their icons. The relevant directories for an application (Psi) are the following:
$PREFIX/share/icons/hicolor/128x128/apps/ $PREFIX/share/icons/hicolor/16x16/apps/ $PREFIX/share/icons/hicolor/192x192/apps/ $PREFIX/share/icons/hicolor/22x22/apps/ $PREFIX/share/icons/hicolor/24x24/apps/ $PREFIX/share/icons/hicolor/32x32/apps/ $PREFIX/share/icons/hicolor/36x36/apps/ $PREFIX/share/icons/hicolor/48x48/apps/ $PREFIX/share/icons/hicolor/64x64/apps/ $PREFIX/share/icons/hicolor/72x72/apps/ $PREFIX/share/icons/hicolor/96x96/apps/ $PREFIX/share/icons/hicolor/scalable/apps/
The spec also says that:
Minimally you should install a 48x48 icon in the hicolor theme. This means installing a PNG file in $prefix/share/icons/hicolor/48x48/apps.
To put it into $XDG_DATA_DIRS words, the application icons should put be their app icons into
$XDG_DATA_DIRS/icons/$theme_name/$size/apps
This means we could put in Psi icons for various sizes, including a SVG icon (see "scalable" dir) - although I have yet to see an application using that functionality.

