Feb 09

How to add a custom launcher entry on Ubuntu

Category: Linux,Ubuntu   — Published by goeszen on February 9, 2022 at 10:49 pm

Ubuntu terminal, the CLI or shell command line
Rights: goeszen.com

This post explains how you add a "start menu entry" or in other words, how you'd add a custom launcher entry to the Ubuntu app launcher menu. This is true for Ubuntu, as well as any other Debian or Linux based distro.

On Debian based systems, each entry in the start menu is represented by a file on disk in a special directory. The system regularly scans these directories and adds or removes entries based on these dirs. These files carry the file suffix .desktop, as such, they are the "desktop files" or ".desktop entries". The represent a so called XDG Desktop Entry.

Contents of these .desktop files follow this freedesktop specification. They look a little like an .ini file. Arch Linux has a nicer formatted overview.

The .desktop file references the binary to execute, the path to the icon to use in the entry, keywords, title, etc. Here's the desktop file for Firefox:

[Desktop Entry]

Add a custom launcher entry via these ".desktop" file paths

In order to add a custom launcher entry you need to create a file and put it into one of these directories;

  • Most of these desktop files reside in the system-wide path /usr/share/applications/
  • Some you'll find in /usr/local/share/applications/
  • But for the current user-only desktop entries should go into ~/.local/share/applications/
    Read that again, that's the hidden ".local" (dot local) dir.

Once you've added a file in one of these directories, your system will more or less immediately pick up the new start menu entry and display it once you open the launcher menu.

Leave a Reply