Distributing a Desktop GUI application for Linux while reaching the widest possible audience is complicated. Typically, the user has to make sure the correct version of the GUI toolkit is installed and configured. When a Linux distribution changes the delivered GUI toolkits, this can be problematic for applications.
Snaps solve these problems and ensure the correct toolkit libraries are shipped alongside the application at all times.
Read the documentation of the GUI toolkit your application uses in order to get started!
- Reduce the size of your snap. This will also speed up how quickly your snap starts!
Switch the compression to
lzoto make your application start up even quicker.
- Make sure your application has a logo in the snap store and screenshots.
- Include a link to your contact page or bugtracker in the store metadata.
Compared to CLI apps, desktop apps typically require three additional features.
- Access to the host system to play sound, create notifications, display a window, etc.
- Access to a GUI toolkit such as GTK or Qt.
- Initialisation of desktop-specific functionality such as fonts, themes and the XDG environment.
Since snap apps are completely sandboxed by default, they cannot play sound, create notifications, or access the X server to display itself. However, it’s easy to make this possible by using the desktop interfaces. These allow you to “poke holes” in the sandbox, to give your application selected access to the host system.
The sandbox also means that your app cannot use the GUI toolkits of the host system. The snap either has to include the toolkit in the snap itself, or it needs to connect to a snap that provides these toolkits. Many toolkits and general desktop features such as fonts and themes also require initialization before the application can start. The extensions make this as easy as possible. They provide parts to bundle or access common GUI toolkits in your snap and a
desktop-launch script which does the required initialization for you.
These methods are not recommended anymore but might be useful as reference.
- Qt 5 support using the
snapcraft-desktop-helpersprovided useful parts and launchers for desktop snaps, but these are deprecated in favor of the
Last updated 2 years ago.