How to Configure Desktop Launchers on Ubuntu 24 with Standard Icons

.desktop launchers on Ubuntu 24 - Icon, Exec, locations

Page content

Desktop launchers on Ubuntu 24 (and most Linux desktops) are defined by .desktop files: small, text-based config files that describe an application or link.

Once you know where to put them and which keys to set-such as Icon= and Exec=-you can add custom launchers to your Desktop or application menu. This guide covers how to configure them and where to find standard icons on Ubuntu for the Icon= field.

ubuntu-desktop icons

What is a .desktop file?

A .desktop file is a freedesktop.org Desktop Entry: a UTF-8 text file with a .desktop extension. It has a [Desktop Entry] group and key-value pairs. Three types are defined: Application (launch a program), Link (open a URL), and Directory (folder in menus). For launchers you care about Application and optionally Link.

The format is used by GNOME (Ubuntu default), KDE, XFCE, and others. System-wide entries are typically in /usr/share/applications/; for Ubuntu package management and installs, new .desktop files there appear in the application menu. User-defined launchers belong in ~/.local/share/applications/ (menu) or ~/Desktop so they show as icons on the desktop.

Where to put launcher files

Location Purpose
~/Desktop Icons on the desktop (when your session uses this as XDG_DESKTOP_DIR)
~/.local/share/applications/ User application menu entries (overrides system ones with the same name)
/usr/share/applications/ System-wide menu entries (managed by packages; avoid editing by hand)

To get a launcher on the desktop on Ubuntu 24, put the .desktop file in ~/Desktop. To have it only in the application menu, put it in ~/.local/share/applications/. You can use the same file in both places (e.g. copy or symlink) if you want it in menu and on desktop.

Minimum launcher content

For an Application launcher you need:

  • Type=Application
  • Name= - label shown in menus and under the icon
  • Exec= - command to run (program path or name in PATH)

Optional but useful: Icon=, Comment= (tooltip), Terminal= (run in terminal), Path= (working directory), TryExec= (check if app is installed). All keys are case-sensitive.

Example minimal launcher:

[Desktop Entry]
Type=Application
Name=My Script
Exec=/home/user/bin/my-script.sh

Save as e.g. ~/Desktop/my-script.desktop. On some desktops you may need to mark it executable: chmod +x ~/Desktop/my-script.desktop.

The Icon= key

Icon= can be:

  1. Theme icon name (no path) - e.g. Icon=utilities-terminal or Icon=firefox. The desktop looks up the icon in the current theme under /usr/share/icons/ (e.g. Yaru, Adwaita, hicolor). This is the preferred option when a suitable icon exists in the standard icon collection.
  2. Absolute path - e.g. Icon=/usr/share/pixmaps/ubuntu-logo.svg or Icon=/home/user/.local/share/icons/myapp.png. Use for custom icons (PNG, SVG, or XPM).

If the icon is missing, the desktop falls back to a default; the launcher still runs if Exec= is correct.

The Exec= key and variables

Exec= holds the command to run. You can pass arguments and use spec-defined variables:

Variable Meaning
%f Single file path (e.g. one selected file)
%F Multiple file paths
%u Single URL
%U Multiple URLs
%i Icon name from the desktop file (e.g. for startup notification)
%c Localized Name
%k Path to the .desktop file

Example: Exec=myeditor %f opens the selected file in myeditor. For a simple launcher with no file/URL argument, a plain command is enough: Exec=firefox or Exec=/usr/bin/gnome-terminal.

If the program must run in a terminal (e.g. a script that needs a TTY), set Terminal=true and use Exec= with the command: Exec=/home/user/scripts/backup.sh.

Optional keys worth using

  • Comment= - Short description; often shown as tooltip.
  • GenericName= - Generic type of app (e.g. “Web Browser”).
  • Categories= - Menu categories (only relevant for entries in applications/); see Desktop Menu Specification.
  • TryExec= - Path to executable; if missing or not executable, the entry can be hidden from menus (useful for optional apps).
  • Path= - Working directory for the application.
  • StartupNotify= / StartupWMClass= - For better taskbar/launcher behavior when the app starts.

Example: custom script launcher on the Desktop

[Desktop Entry]
Type=Application
Name=Daily Backup
Comment=Run backup script
Exec=/home/user/scripts/daily-backup.sh
Icon=utilities-terminal
Terminal=true
Path=/home/user

Save as ~/Desktop/daily-backup.desktop, run chmod +x ~/Desktop/daily-backup.desktop if your desktop requires it, and the icon should appear on the desktop. Double-clicking runs the script in a terminal.

For a launcher that opens a URL, use Type=Link and URL=:

[Desktop Entry]
Type=Link
Name=Project Wiki
Comment=Open project wiki in browser
URL=https://wiki.example.com/project
Icon=web-browser

Same rules for Name and Icon; the desktop will open URL with the default browser or handler.

Troubleshooting

  • Launcher doesn’t run - Check Exec= (full path or command in PATH). For scripts, ensure they are executable and that Terminal=true if they need a terminal. Checking your Ubuntu version and desktop (GNOME vs KDE) can help when behavior differs.
  • Wrong or missing icon - Use a known theme icon name (e.g. from /usr/share/icons/Yaru/ or standard icons) or an absolute path to a valid image file.
  • Not visible on desktop - Confirm the file is in ~/Desktop, has a .desktop extension, and (on some setups) is executable. For file manager differences (Nautilus vs Nemo, etc.), desktop handling is usually the same for .desktop files in ~/Desktop.
  • Not in application menu - Put the file in ~/.local/share/applications/. If a system entry with the same filename exists, the user file takes precedence. You can install and manage packages to add or remove system .desktop files.

After editing .desktop files, the menu cache may need to refresh; logging out and back in or running update-desktop-database (if available) can apply changes.

References