Developing

Interface management

When a snap needs to access a resource outside of its own confinement, it uses an interface. Interfaces enable resources from one snap to be shared with another.

Interfaces are commonly used to enable a snap to access OpenGL acceleration, sound playback or recording, your network and your $HOME directory. But which interfaces a snap requires, and provides, is very much dependent on the type of snap and its own requirements.

Most users don’t need to worry about interfaces. Snaps are designed for strong application isolation and safe interface connections are made automatically.

To see which interfaces a snap is using, type snap connections <snapname>:

In the above output, you can see that VLC isn’t using the camera interface because its slot is empty, and that the home interface is connected to the system $HOME directory (denoted by the :home slot name).

Slots and plugs

An interface consists of a connection between a slot and a plug. The slot is the provider of the interface while the plug is the consumer, and a slot can support multiple plug connections.

In the output to snap connections vlc (see above), every interface used by VLC is listed in the first column. The Plug and Slot columns then describe how each interface is connected. For instance, the pulseaudio interface connects VLC’s PulseAudio plug to the system’s PulseAudio slot, shown as pulseaudio vlc:pulseaudio :pulseaudio -.

You can see which other snaps are using an interface with the interface command:

Interfaces provided by the system begin with the : (colon) symbol and are implemented by the Core snap, such as with :pulseaudio in the above output. For a slot to be visible, and connectable, its corresponding snap needs to be installed.

To view which snaps provide connectable slots and plugs, use the snap interface <interface name> command (not the connections command we used earlier):