Skip to content

Instantly share code, notes, and snippets.

@jotelha
Last active July 17, 2019 12:57
Show Gist options
  • Save jotelha/4f1f5d1fa0b87623b38267843818031d to your computer and use it in GitHub Desktop.
Save jotelha/4f1f5d1fa0b87623b38267843818031d to your computer and use it in GitHub Desktop.
Create custom application launchers for Ubuntu 18.04

On Ubuntu (18.04), system-wide desktop launcher files are found within /usr/share/applications/. Within ${HOME}/.local/share/applications/ create custom starter files:

Samples:

  • firefox.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Firefox User Install
GenericName=Browser
Comment=Web Browser
Exec=bash -c "$(dirname $(readlink -f %k))/firefox %u"
Icon=firefox-mozilla-build
Terminal=false
X-MultipleArgs=false
StartupWMClass=Firefox
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
  • zotero.desktop
[Desktop Entry]
Name=Zotero
Exec=bash -c "$(dirname $(readlink -f %k))/zotero -url %U"
Icon=/home/jotelha/opt/Zotero_linux-x86_64/chrome/icons/default/default256.png
Type=Application
Terminal=false
Categories=Office;
MimeType=text/plain
  • ovito.desktop
[Desktop Entry]
Name=Ovito 3.0.0-dev234
Exec="/home/jotelha/opt/ovito/3.0.0-dev234/bin/ovito"
Type=Application
Terminal=false
Categories=Office;
MimeType=text/plain

The zotero and firefox launchers are examples for launcher files placed within the same directory as the according executable. They are then linked to the launcher directory, i.e. with

ln -s ~/opt/firefox/firefox.desktop ~/.local/share/applications/firefox.desktop

Such new launchers should be accessible immediately without any additional steps. Otherwise, use sudo update-desktop-database to enforce reloading changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment