Desktop Launcher Actions (Linux)

Overview

On many Linux environments, you can add custom entries to the system launcher by modifying the .desktop file. For Canonical’s Unity documentation, see Adding Shortcuts to a Launcher. For details on a more generic implementation, see the freedesktop.org Specification.

audacious

NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player

To create a shortcut, you need to provide Name and Exec properties for the entry you want to add to the shortcut menu. Unity will execute the command defined in the Exec field after the user clicked the shortcut menu item. An example of the .desktop file may look as follows:

  1. Actions=PlayPause;Next;Previous
  2. [Desktop Action PlayPause]
  3. Name=Play-Pause
  4. Exec=audacious -t
  5. OnlyShowIn=Unity;
  6. [Desktop Action Next]
  7. Name=Next
  8. Exec=audacious -f
  9. OnlyShowIn=Unity;
  10. [Desktop Action Previous]
  11. Name=Previous
  12. Exec=audacious -r
  13. OnlyShowIn=Unity;

The preferred way for Unity to instruct your application on what to do is using parameters. You can find them in your application in the global variable process.argv.