Proposal: Inharitance for Desktop Entry Spec
pcman.tw at gmail.com
Wed Apr 16 19:19:56 PDT 2008
My name is 洪任諭 (Hong Jen Yee), and my nickname is pcman.
I'm the lead developer of project LXDE - lightweight X11 desktop environment.
I have a proposal for the current "Desktop Entry Spec".
Let desktop entry files derive from another desktop file.
Desktop entry files get widely used today, but there exists some
If the user want to override an system-wide dekstop_id, normally,
he/she should create a desktop entry files with the same name, and put
it in $XDG_DATA_HOME. Currently, the best way to do this is to copy
the system-wide desktop entry file to ~/.local/applications, and do
the modification you want. At first this looks good and reasonable.
It, however, is problematic. Imagine the following senario:
1. The program has a new release, and it installs a new desktop file
with different Exec or TryExec keys. Apparantly, the user-created one
2. Having to copy the system-wide desktop files to make a custom one
is not only quite dirty, but also make unnecessary duplicated files.
For desktop files containing a lot of translation (like the desktop
files owned by gnome), this does matters.
3. If the new releases of programs have new names, or change the
description (comment) in their new system-wide desktop file installed
in /usr/share/applications, these changes will never be reflected in
the user custom one.
4. The user custom one, will lack some translation. When the users
login to desktop in another language, they can only get English names
even if new translation is already available in the system-wide one
after system update. Any change to the system-wide desktop entry files
will never be reflected in the user custom one.
So, current approach is some what dirty, problematic, and hard to
implement and maintain.
Here is a proposal trying to fix these problems by adding a new key
Here is an example of the proposed new format of the new user custom
desktop entry files.
Preceding example demostrate the senario that I only want to override
a key of the system-wide desktop file. So I inherits the system-wide
one, and add the keys I want to override. nm-applet.desktop is the
desktop entry file of network manager applet for gnome-panel. On
ubuntu, it "OnlyShowIn" GNOME and XFCE. If I want to make it visible
in other desktop environment, I can simply override the OnlyShowIn
key, and don't need to touch the rest parts. If the system update
change anything in the system-wide nm-applet.desktop, the custom one
created by me can automatically get the updated info.
Under ubuntu, there is an "synaptic.desktop" and
"synaptic-kde.desktop". Basically they are the same application. The
only differences of these two files are the Exec key. They just need
different sudo frontend. One uses gksu, and the other uses kdesu. By
adopting my proposal, there is no need to maintain two desktop files.
You just derive synaptic-kde.desktop from synaptic.desktop, and
override the "Exec" key. Then, all things are perfect! Both the users
and developers are happy.
Also, the implementation is quite easy.
When Inherit key is found in desktop entry file, the implementor
should load the file specified by the "Inherit" key, and then, get the
other keys listed in the custom one and replace them properly.
Especialy, doing this with glib's GKeyFile is a piece of cake.
This is my proposal fixing many existing problems of the original
desktop entry spec.
Hope that someone can review this and give some comment. Even better,
adopt this in the latest spec.
Thank you very much.
More information about the xdg