Desktop applications


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.

Getting Started

Compared to CLI apps, desktop apps typically require three additional features.

  1. Access to the host system to play sound, create notifications, display a window, etc.
  2. Access to a GUI toolkit such as GTK or Qt.
  3. 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 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 snapcraft-desktop-helpers 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 initialisation for you.

Read the documentation of the GUI toolkit your application uses in order to get started!

These additional resources might also be useful for graphical applications.

Snap documentation
Snap documentation
Snapcraft checklist
Proposed new documentation outline