August 2020

Plank is a popular application launcher dock in Linux. By default, most application desktop entries do not provide any additional actions. Say we want to add an open ‘new window’ action to our desktop entry for pkgbrowser:

/usr/share/applications/pkgbrowser.desktop

Our desktop entry file looks as follows:

[Desktop Entry]
Name=PkgBrowser
GenericName=Package Browser
Comment=A utility for browsing pacman databases and the AUR
Exec=pkgbrowser
Terminal=false
Type=Application
Icon=pkgbrowser
StartupNotify=false
Categories=Qt;System;

Simply add the following to the end of the file. Of course, if your desktop entry already has a defined Actions property, you’ll want to add this new-window to it.

Actions=new-window;

[Desktop Action new-window]
Name=New Window
Exec=pkgbrowser

Now, right-clicking the desktop entry will appear as follows:

By default, any desktop entries that come from packages for your Linux distro will be overwritten during a package update. To prevent this from happening, you can made the file read-only using chattr:

sudo chattr +i /usr/share/applications/pkgbrowser.desktop