Desktop interface¶
The desktop interface provides access to the host system’s display (Wayland/X11) socket(s) from inside the workshop, allowing it to securely run GUI applications.
By using the interface, the SDK publisher allows the workshop to utilize the host’s display which can be useful for various SDK-specific tasks such as building graphical applications or using editors without remote support.
Desktop interface plug¶
An essential element here is the desktop interface plug, which is declared in the SDK definition.
Its structure includes just the name of the plug and the interface;
both must be set to desktop.
Defining the plug in an SDK allows the workshops using this SDK to access the host’s display, which can be useful for various SDK-specific tasks such as building graphical applications or using editors without remote support.
Desktop interface slot¶
To let SDKs in a workshop access the host’s display, Workshop provides a desktop interface slot that multiple desktop interface plugs can access.
When the SDK is installed at runtime during launch and refresh operations, Workshop checks that the plug targeting the slot passes validation; if it does, it can be connected.
Connection¶
The interface isn’t connected automatically at launch and refresh for security reasons. The workshop connect and workshop disconnect commands can be invoked manually after the workshop has started:
$ workshop connect ws/desktop-sdk:desktop
$ workshop disconnect ws/desktop-sdk:desktop
Establishing a connection means a proxy Unix domain socket has been created and the following environment variables have been set:
Wayland |
X11 |
Both |
|---|---|---|
$WAYLAND_DISPLAY$XDG_SESSION_TYPE$QT_QPA_PLATFORM$ELECTRON_OZONE_PLATFORM_HINT$XDG_BACKEND |
$DISPLAY$XDG_SESSION_TYPE$QT_QPA_PLATFORM$ELECTRON_OZONE_PLATFORM_HINT$XDG_BACKEND$XAUTHORITY* |
$WAYLAND_DISPLAY$DISPLAY$XDG_SESSION_TYPE$QT_QPA_PLATFORM$ELECTRON_OZONE_PLATFORM_HINT$XDG_BACKEND$XAUTHORITY* |
*only set if present on the host
To check if the interface is connected:
$ workshop connections --all
INTERFACE PLUG SLOT NOTES
...
desktop ws/desktop-sdk:desktop ws/system:desktop manual
This means the host’s display socket (Wayland, X11 or both) is available inside the workshop:
$ workshop shell ws
workshop@ws-8584e571$ ls $XDG_RUNTIME_DIR | grep wayland
wayland-1
$ workshop shell ws
workshop@ws-8584e571$ ls /tmp/.X11-unix
X0
See also¶
Explanation:
Reference: