Launchers are small programs that modify the runtime environment to make a snapped application function properly. They’re typically scripts that modify environment variables before running the application itself.
A launcher can be bundled into the packaging source tree, or included as an independent part that sources a remote repository.
NOTE: Many Snapcraft Extensions add launchers to modify the runtime environment. Using extensions is often preferred over manually adding a launcher.
How to use
To use a launcher, include it in the snap and insert its definition, in the proper order, in the command chain in the
apps: _app_name_: adapter: full command: _app_command_ command-chain: - _launcher_
Launchers can be stacked to apply multiple modifications before starting the app.
apps: _app_name_: adapter: full command: _app_command_ command-chain: - _a_launcher_ - _b_launcher_
Stacking launchers works because at the end of each launcher, it runs the arguments it received. So a_launcher will run
b_launcher app_command and b_launcher will run
When a launcher depends on another launcher(e.g. perl-launch), both need to be included in a snap and be invoked in the proper order in the command chain.
How to make
- Identify the proper component that requires patching.
- Check out the component’s documentation or code to find out whether its behavior can be changed via environment variables or other means. If none can be found patch it and/or ask the component’s author to implement one.
- Implement a launcher that changes the environment variables, etc.
- At the end of the launcher script,
execthe arguments of the launcher. This will execute the next launcher in the chain or the command itself. In bash, you can do this by adding the line
- (Recommended) write documentation regarding the usage of your launcher at Latest doc topics - snapcraft.io.
List of known launchers
classic-launch: Strict confinement-like runtime environment for classic confinement snaps.
debian-multiarch-triplet-provider-launch: Enable DEBIAN_MULTIARCH_TRIPLET-like environment variable in the snap runtime.
gettext-launch Fix gettext-based internationalization in the snap runtime.
git-launch: Fix Git functionality in the snap runtime environment.
homeishome: Fix snapped apps that (wrongly) referring to the user’s real home directory instead of $HOME.
locales-launch: Fix Glibc locales in the snap runtime.
magic-launch: Fix file type detection based on libmagic.
ncurses-launch: Fix ncurses applications in the snap runtime.
perl-launch: Fix Perl applications in the snap runtime.
session-manager-workaround: Silent error messages due to inaccessible paths.
snapcraft-preload: Use smart preloading in your snaps to avoid hard coded parts that would fail security.
tcltk-launch: Fix Tcl/Tk applications in the snap runtime.