gtk-launch
Launch a graphical application by its name
TLDR
Launch an application
Display help
SYNOPSIS
gtk-launch [OPTION...] DESKTOPFILE [URI...]
PARAMETERS
-h, --help
Print help and exit
DESCRIPTION
gtk-launch is a lightweight command-line utility from the GTK toolkit designed to launch graphical applications by referencing their .desktop files. It simplifies starting apps in minimal environments like window managers or terminals without a full desktop environment.
The tool locates the specified DESKTOPFILE (without .desktop extension) in standard XDG directories: first $XDG_DATA_HOME/applications, then $XDG_DATA_DIRS/applications. It parses the file's Exec= entry to execute the application, supporting the Freedesktop Desktop Entry Specification.
Optional URIs can be provided as trailing arguments, passed directly to the app if it handles them (e.g., browsers). This makes it ideal for scripts or quick launches.
For instance, gtk-launch firefox starts Firefox, or gtk-launch nautilus /home/user opens the file manager at that path. It leverages GIO's GDesktopAppInfo for robust handling, ensuring compatibility with modern Linux desktops.
Requires GTK runtime libraries; fails silently if the .desktop file is missing or invalid.
CAVEATS
Requires GTK libraries and valid .desktop files in XDG paths; no fallback to PATH search; may fail for non-GTK apps without proper Exec= lines.
EXAMPLES
gtk-launch gnome-terminal
gtk-launch firefox https://example.com
gtk-launch gedit document.txt
ENVIRONMENT
Respects XDG_DATA_HOME and XDG_DATA_DIRS for .desktop search.
HISTORY
Introduced in GTK+ 3.3 (2011) as part of gtk-utils package; evolved with GTK 4 as gtk4-launch; promotes XDG standards in minimal setups.


