gtk-launch
Launch a graphical application by its name
TLDR
Launch an application
Display help
SYNOPSIS
gtk-launch [OPTION...] APPLICATION... [ARGUMENT...]
PARAMETERS
-?
Displays a brief help message indicating common usage.
--help
Displays more comprehensive help options for the command, including available arguments and options.
--version
Outputs the version information of the gtk-launch
utility.
APPLICATION...
One or more names of the applications to launch. These names typically correspond to the filename (without the .desktop extension) of the application's desktop entry, e.g., 'firefox' for firefox.desktop.
ARGUMENT...
Optional arguments to pass directly to the launched application. These arguments are appended to the command specified in the Exec key of the .desktop file.
DESCRIPTION
gtk-launch
is a command-line utility for launching applications registered with the GIO (Glib Input/Output) subsystem, which is fundamental to GTK-based desktop environments. Instead of requiring the user to know the exact path to an executable, gtk-launch
allows applications to be started by their symbolic name, as defined in a .desktop file. These .desktop files adhere to the XDG Desktop Entry Specification and typically reside in standard directories like ~/.local/share/applications or /usr/share/applications.
When invoked, gtk-launch
parses the specified application's .desktop file to retrieve information such as the executable path and any default arguments defined in the Exec key. Any additional arguments provided on the command line are then appended to this command before execution. This mechanism provides a standardized and user-friendly way to integrate and launch applications within a desktop environment, abstracting away the underlying complexity of their execution paths and initial parameters.
CAVEATS
gtk-launch
relies entirely on the presence and correctness of .desktop files in standard XDG application directories. If a .desktop file is missing, misnamed, or malformed, the application may fail to launch orgtk-launch
may report an error.- It is designed to launch applications defined by .desktop entries, not arbitrary executable paths or shell commands. For general command execution, use a shell directly.
- The security of
gtk-launch
is dependent on the integrity of .desktop files. Maliciously crafted .desktop files could potentially execute unwanted commands.
XDG DESKTOP ENTRY SPECIFICATION
The behavior of gtk-launch
is governed by the XDG Desktop Entry Specification. This standard defines the format of .desktop files, which are simple configuration files used to describe applications, their icons, categories, and most importantly, how they are launched via the Exec key. gtk-launch
parses these files to execute the appropriate command.
APPLICATION SEARCH PATHS
gtk-launch
searches for .desktop files in a predefined set of directories, typically following the XDG Base Directory Specification. Common search paths include:
~/.local/share/applications/ (for user-specific applications)
/usr/local/share/applications/ (for system-wide, locally installed applications)
/usr/share/applications/ (for system-wide, packaged applications)
HISTORY
gtk-launch
is an integral part of the GTK toolkit, specifically leveraging the GIO library for application management. Its development stems from the need for a standardized, desktop-agnostic method of launching applications based on their semantic names rather than direct paths. It has evolved alongside the XDG Desktop Entry Specification, becoming a common utility in Linux desktop environments to ensure consistent application launching behavior across various desktop shells like GNOME, KDE, Xfce, etc.
SEE ALSO
xdg-open(1), gio(1), desktop-file-install(1), update-desktop-database(1)