Why arbitrary executables?
Posted Feb 12, 2009 19:58 UTC (Thu) by
GhePeU (subscriber, #56133)
In reply to:
Why arbitrary executables? by endecotp
Parent article:
How to write a Linux virus in 5 easy steps
Can anyone suggest a sane use-case where a .desktop file needs to specify an arbitrary executable? I would have thought that in 99% of the uses of these things they should indicate their MIME type (or equivalent) and the desktop should use that to determine the executable to run.
You got it backwards: the .desktop files are what the system use to decide what executable must be used to open a file with a specific MIME type.
$ cat /usr/share/applications/gedit.desktop
[Desktop Entry]
Name=Text Editor
Comment=Edit text files
Exec=gedit %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=accessories-text-editor
Categories=GNOME;GTK;Utility;TextEditor;
When nautilus finds a file with the mimetype 'text/plain' it looks through all the .desktop files in the system- and user-specific directories until it finds one who lists the correct mimetype and launch the indicated executable with the specified parameter.
To gnome-menus the same file means "add to the Accessories menu an entry named 'Text Editor' with the tooltip 'Edit text files' and the icon 'accessories-text-editor', then if the user click on this entry launch the command 'gedit'".
A .desktop file needs to specify an arbitrary executable.
(
Log in to post comments)