Skip to content

kde-nested

Recipe card from the charly-selkies plugin (Images — the deployable catalog).

kde-nested — Plasma nested in any Wayland compositor

Section titled “kde-nested — Plasma nested in any Wayland compositor”

One candy, kde-nested, with one supervised service, kde-nested, that runs kde-nested-session:

  1. waits (bounded) for the host compositor’s socket in KDE_NESTED_RUNTIME_DIR;
  2. starts kwin_wayland --wayland-display <host> --socket <own> --xwayland;
  3. waits for KWin’s socket and starts plasmashell on it.

The candy composes layer-kde-shell (Plasma without SDDM, plus the session bus via pod-dbus and kdotool). It also strips cap_sys_nice from kwin_wayland at build time, because the pod’s no-new-privileges refuses to exec a file-capability binary.

variable default meaning
KDE_NESTED_HOST_DISPLAY wayland-0 the host compositor’s socket KWin nests into
KDE_NESTED_SOCKET wayland-kde the socket KWin serves to Plasma and its apps
KDE_NESTED_RUNTIME_DIR inherited XDG_RUNTIME_DIR, else /tmp the XDG_RUNTIME_DIR holding both sockets
KDE_NESTED_RESOLUTION empty WxH of KWin’s window; empty takes the host’s configure
KDE_NESTED_BUS session session = the pod’s shared bus; private = dbus-run-session

The composing pod sets them in its own candy env:. A later candy’s env: overrides an earlier one’s.

pod host KWin socket runtime dir size bus
pod-kde-vnc sway wayland-0 wayland-kde /tmp 1920x1080 session
pod-kde-vnc-cdp sway wayland-0 wayland-kde /tmp 1920x1080 session

pod-kde-vnc-cdp composes pod-kde-vnc, so it inherits the same five knobs and adds only Chrome — there is no second nested-session configuration. The KDE_NESTED_BUS=private knob stays: a compositor whose session bus the venue’s dbus: verb cannot see still needs it.

  • Never startplasma-wayland. Without a systemd session it falls back to a headless KWin that holds no connection to the host, so the host shows a black frame.
  • KWin needs WAYLAND_DISPLAY=<host> as well as --wayland-display. Without it the nested output stays black.
  • The KWin socket must not collide with a numbered host socket. pod-sway’s sway serves wayland-1 behind a wayland-0 symlink, which is why the default is wayland-kde.
  • KDE_SESSION_VERSION=6 is exported, because kdotool refuses to run without it.
  • Typing into Plasma goes through the transport (VNC key events, cstream control events), never wtype: the nested KWin re-maps a client’s private keymap and the text arrives garbled.

The leaf’s plan proves:

  • at build time: the launcher, the nesting invocation, no caps on kwin_wayland, and kdotool;
  • at runtime: the kde-nested service RUNNING and plasmashell.

KWin’s renderer (OpenGL, not llvmpipe) is asserted by each pod’s bed on the bus that pod chose, e.g. dbus: call org.kde.KWin /KWin org.kde.KWin.supportInformation.