electron/docs/tutorial/linux-desktop-actions.md
Erick Zhao 62366aeb95
docs: remove platform notices from tutorial titles (#32937)
* docs: remove platform notices from tutorial titles

* Update docs/tutorial/launch-app-from-url-in-another-app.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Mark Lee <malept@users.noreply.github.com>
2022-03-03 09:56:00 -08:00

1.7 KiB

title description slug hide_title
Desktop Launcher Actions Add actions to the system launcher on Linux environments. linux-desktop-actions true

Desktop Launcher Actions

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:

Actions=PlayPause;Next;Previous

[Desktop Action PlayPause]
Name=Play-Pause
Exec=audacious -t
OnlyShowIn=Unity;

[Desktop Action Next]
Name=Next
Exec=audacious -f
OnlyShowIn=Unity;

[Desktop Action Previous]
Name=Previous
Exec=audacious -r
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.