Community-driven coverage of elementary OS — news, guides & forums
Dark abstract low-poly geometric landscape with layered triangular facets in deep navy, charcoal, and muted teal, illuminated by a soft electric-blue glow near the horizon

News roundups, tutorials, application guides, and forums — built by users, for users of the elegant Linux distribution.

elementary weekly
#20
Latest roundup · 18 Apr 2015
Freya Release
Final
Covered in weekly #19 & #20
Forum Topics
Active
Installation, customization & more

Custom Application Launchers for elementary OS

A custom launcher turns a command, script, AppImage, or alternate application profile into something you can open from the Applications menu, dock, or file manager. On elementary OS, this usually involves a small shell script paired with a .desktop entry. The result feels like a normal application, even when the program needs special options or a few setup steps first.

This approach is useful when you want separate browser profiles, a one-click development environment, a game started with launch arguments, or an AppImage that does not integrate cleanly with the desktop. It also suits Australian users working with patchy NBN connections, travelling between Brisbane and Perth, or keeping a lightweight Linux laptop ready for uni, work, and the occasional arvo project.

Launcher method Best for Main location Level of control
Direct .desktop file An application with simple arguments ~/.local/share/applications Basic
Shell script plus .desktop file Environment variables, checks, and multiple commands ~/.local/bin and ~/.local/share/applications High
AppImage launcher Portable applications downloaded outside AppCenter A folder such as ~/Applications Medium
Flatpak wrapper Sandboxed apps needing a repeatable command ~/.local/bin and a .desktop file High
Terminal shortcut Commands used occasionally Shell configuration or Terminal Low

Understand How elementary OS Launchers Work

A launcher on Linux is generally a desktop entry file ending in .desktop. It contains metadata such as the application name, icon, category, and command to execute. elementary OS reads user-created entries from ~/.local/share/applications, so you can add personal launchers without changing system files or requiring administrator access.

The most important line is Exec. It must contain a real executable path or command, and it follows desktop-entry rules rather than normal shell parsing. Tilde expansion is not reliable there, so use /home/your-name/... or place the logic in a script. A command such as Exec=firefox --new-window is suitable for a simple case, while a shell script is safer when you need variables, conditional checks, or several commands.

A launcher script is an ordinary executable file. It can set an environment variable, select a profile, check whether a required folder exists, and then replace itself with the target program using exec. The .desktop file provides the graphical integration; the script provides the flexible behaviour. Keeping those jobs separate makes later editing easier.

This distinction matters with Flatpak applications. A command that works in Terminal might be flatpak run org.mozilla.firefox, but an application launcher should still use a script if you need to prepare folders, set options, or handle file arguments. Sandboxing can also affect access to external drives, Downloads, and folders mounted through a NAS, so test the command from the same account that will use the launcher.

Create A Reliable Launcher Script

Start by creating a personal bin directory and a script. Open Terminal and run:

mkdir -p "$HOME/.local/bin"
nano "$HOME/.local/bin/work-browser"

Paste this example, replacing the profile path if required:

#!/usr/bin/env bash
set -euo pipefail

PROFILE="$HOME/.mozilla/firefox/elementary-work"

mkdir -p "$PROFILE"
exec /usr/bin/firefox --new-instance --profile "$PROFILE" "$@"

Save with Ctrl+O, press Enter, and leave Nano with Ctrl+X. Make the script executable:

chmod +x "$HOME/.local/bin/work-browser"

The #!/usr/bin/env bash line selects Bash, while set -euo pipefail makes common mistakes fail clearly instead of continuing silently. "$HOME" works for any account, which is better than copying a path that only works on your machine. The final "$@" passes files or URLs supplied by the desktop to Firefox. If your browser is installed as a Flatpak, replace the final line with something like:

exec flatpak run org.mozilla.firefox --new-instance --profile "$PROFILE" "$@"

Use command -v firefox to check whether the native executable is available. For a Flatpak, run flatpak list --app and look for its application ID. AppImage programs can be launched in the same way, provided the file has execute permission:

exec "$HOME/Applications/Obsidian.AppImage" "$@"

A script can also prepare a working directory or set an environment variable:

#!/usr/bin/env bash
set -euo pipefail

export EDITOR="io.elementary.code"
cd "$HOME/Projects/client-notes"
exec flatpak run md.obsidian.Obsidian "$@"

Use absolute paths for important files and quote paths containing spaces. Avoid placing passwords, API keys, or banking credentials in scripts. A launcher is convenient, but it is still a plain text file that other people with access to your account could read.

Add The Graphical Desktop Entry

Once the script works in Terminal, create its desktop entry:

mkdir -p "$HOME/.local/share/applications"
nano "$HOME/.local/share/applications/work-browser.desktop"

Use this content:

[Desktop Entry]
Version=1.0
Type=Application
Name=Work Browser
Comment=Open Firefox with the work profile
Exec=/home/alex/.local/bin/work-browser %U
Icon=firefox
Terminal=false
Categories=Network;WebBrowser;
StartupNotify=true

Replace alex with your actual username. You can find it with whoami. The %U field allows the launcher to receive one or more URLs. Use %f for one local file, %F for several files, or omit the field when the script never needs input. Do not write Exec=~/.local/bin/work-browser; desktop entries do not consistently expand the tilde.

For a custom icon, set Icon to an installed icon name or an absolute path:

Icon=/home/alex/.local/share/icons/work-browser.svg

Create the icon directory first if needed:

mkdir -p "$HOME/.local/share/icons"

SVG is usually a good choice because it remains sharp at different sizes. PNG files also work. Keep filenames simple and avoid spaces while you are testing.

Make the desktop entry readable and executable:

chmod +x "$HOME/.local/share/applications/work-browser.desktop"

The Applications menu should discover it after a short delay. If it does not appear, refresh the desktop-entry cache:

update-desktop-database "$HOME/.local/share/applications"

If that command is unavailable, install the package that provides desktop-entry utilities through your usual package manager, or log out and back in. You can often right-click the application in the Applications menu and add it to the dock. This gives a dedicated icon for a second browser profile rather than making you remember a Terminal command every time.

Support Flatpaks, AppImages, And Multiple Profiles

The same pattern works for almost any application that accepts command-line options. A design tool might need a particular workspace, a game may require a compatibility flag, and a development editor could open a project directory automatically. For example:

#!/usr/bin/env bash
set -euo pipefail

PROJECT="$HOME/Projects/sample-site"

if [[ ! -d "$PROJECT" ]]; then
    mkdir -p "$PROJECT"
fi

exec flatpak run com.visualstudio.code "$PROJECT" "$@"

The Flatpak application ID must match the package installed on your system. Check it with:

flatpak list --app --columns=application,name

Flatpak permissions can be the source of confusion. An application may launch normally but fail to open a project on an external SSD or a shared folder. Inspect its permissions with:

flatpak info --show-permissions com.visualstudio.code

Only grant additional filesystem access when it is needed, and understand that broad access such as home gives the application much more visibility. For a narrow folder, tools such as Flatseal can make permissions easier to inspect, although command-line configuration is preferable when you want a setup that can be reproduced on another computer.

AppImages need a different first step. Store them somewhere consistent, such as ~/Applications, then make the file executable:

mkdir -p "$HOME/Applications"
chmod +x "$HOME/Applications/example.AppImage"

Your script can point directly to that file. This is handy when the vendor distributes an AppImage because the Australian Linux software market is smaller than the Windows and macOS markets, and some specialist tools skip native Debian packages. Check download sources carefully, keep the AppImage updated, and avoid executing files from an untrusted forum post.

Multiple profiles are particularly useful on a shared household computer or a machine used for both employment and study. Separate launchers can open a personal browser, a work browser, and a testing profile with distinct icons and names. On a Brisbane uni laptop, for example, this can keep coursework tabs and personal accounts apart without maintaining separate user accounts.

Test, Pin, And Maintain The Launcher

Test the underlying script before testing the desktop entry:

"$HOME/.local/bin/work-browser"

Then run the desktop entry’s command exactly as it appears in Exec, including any argument field. If nothing opens, inspect permissions and paths first:

ls -l "$HOME/.local/bin/work-browser"
ls -l "$HOME/.local/share/applications/work-browser.desktop"

A common error is saving the file as work-browser.desktop.txt. In Files, enable file extensions or use ls in Terminal to confirm the exact name. Another is a missing executable bit on the script. The launcher entry itself can be executable, but the target script must also have chmod +x.

If the application opens and immediately closes, run the script in Terminal without exec temporarily, or add a simple log line:

printf '%s\n' "Starting work browser" >> "$HOME/.cache/work-browser.log"

For more detailed diagnostics, launch the program manually and read its error output. If the problem only occurs from the Applications menu, compare the desktop environment with your shell environment. GUI launchers may not load the same PATH or shell startup files as Terminal, so use full paths for commands such as flatpak, firefox, or an AppImage.

When a launcher is ready, search for its Name in Applications and pin it to the dock. To update it later, edit either the script or desktop file in place. A useful convention is to use a descriptive filename, such as photo-editor-raw.desktop, rather than a generic name like shortcut.desktop. This is especially helpful when several launchers appear together.

Use local paths and network assumptions thoughtfully. An NBN outage in regional New South Wales or a trip across Perth may leave cloud-dependent tools unavailable, so a script can check for a local project folder before opening the application. You might also create a separate launcher for an offline notes vault. Keep the command simple enough that it behaves predictably when you are working away from home, rather than relying on a mounted share that is only present at your desk.

Launcher files are easy to back up because they are plain text. Copy ~/.local/bin, ~/.local/share/applications, and any custom icons to a private backup. Before restoring them on another machine, change the username in absolute paths and verify that the same Flatpak IDs or AppImage filenames exist. A Perth workstation and a Melbourne laptop may have different home-directory names, even when the launcher design is identical.

For a final check, open the Applications menu, start the custom entry, open a URL or file through it, and confirm that the correct profile and icon are used. Then run chmod +x "$HOME/.local/bin/work-browser" once more and keep that script as the single source of truth for the launcher.

The finished setup gives elementary OS a native-feeling shortcut while retaining the transparency of a shell script. It can be edited with any text editor, copied to another computer, and removed without leaving a package behind. Run desktop-file-validate "$HOME/.local/share/applications/work-browser.desktop" now to check the completed entry.

Browse the News Archive
Latest Updates

From the elementary weekly series

Low-poly faceted abstract render in dark charcoal and electric blue tones, suggesting a news bulletin or announcement
elementary news

elementary weekly #20

The first week with the final Freya release — community reactions, tips, and early impressions gathered in one roundup.

Abstract low-poly geometric scene in midnight blue and soft cyan, conveying a live broadcast or event atmosphere
elementary news

elementary SPECIAL

A live Hangouts event with the elementary OS founders, held on 11 April 2015, discussing the Freya final release.

Low-poly faceted render in deep navy and muted teal with subtle amber highlights, suggesting a tutorial or guide
Tips and Tricks

Timeshift Guide

How to use Timeshift — the intuitive system restore utility for elementary OS — to recover from configuration mishaps.

Explore

Topics & Resources

Dive into guides, application recommendations, and community discussions covering every aspect of elementary OS.