Files
punktfunk/scripts/punktfunk-kde-session.service
T
enricobuehler 8c58afa2ac
ci / rust (push) Has been cancelled
feat(headless): boot-appliance systemd units (KDE session + host, no login)
Make a headless box a self-contained streaming appliance: after boot, with no
display manager / login / manual script, the headless KWin Plasma session and
the punktfunk host both come up so a client can just connect and stream the
desktop.

- New scripts/punktfunk-kde-session.service: a Type=simple user unit that runs
  run-headless-kde.sh (kwin --virtual on wayland-kde + Plasma + portals + a
  supervised plasmashell). The script foregrounds on `wait $KWIN_PID`, so
  Restart=always keeps the desktop alive across a KWin crash.
- scripts/punktfunk-host.service: ExecStart now `serve --native` (the unified
  GameStream + punktfunk/1 host, matching how it's actually run), After= the
  kde-session unit (soft ordering — the host listens immediately and only needs
  the compositor per session, so a missing unit on the gamescope backend is
  harmless), and appliance install docs (kwin vs gamescope backend).

Boot still requires `sudo loginctl enable-linger $USER` (the one thing that
starts user units without a login) — documented in both unit headers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 21:16:12 +00:00

34 lines
1.7 KiB
Desktop File

# punktfunk headless KDE Plasma session — systemd USER unit.
#
# Brings up `kwin --virtual` on WAYLAND_DISPLAY=wayland-kde plus the full Plasma desktop
# (portals, polkit agent, a supervised plasmashell) via run-headless-kde.sh, so the punktfunk
# host's *kwin* backend can stream the live desktop. This is what makes a headless box a
# self-contained streaming appliance: no display manager, no login, no manual script — the
# session comes up at boot. Pair it with punktfunk-host.service (kwin backend) + linger.
#
# The script foregrounds on `wait $KWIN_PID` and re-spawns plasmashell for KWin's lifetime, so
# Type=simple + Restart=always keeps the desktop alive (a KWin crash brings the whole session
# back). It sets its own env (XDG_CURRENT_DESKTOP=KDE, WAYLAND_DISPLAY=wayland-kde,
# XDG_MENU_PREFIX=plasma-, …) — see run-headless-kde.sh.
#
# Appliance install (boot with no interaction):
# cp scripts/punktfunk-kde-session.service scripts/punktfunk-host.service ~/.config/systemd/user/
# cp scripts/host.env.example ~/.config/punktfunk/host.env # edit for the kwin backend
# systemctl --user daemon-reload
# systemctl --user enable punktfunk-kde-session punktfunk-host
# sudo loginctl enable-linger "$USER" # <-- starts user units at boot WITHOUT a login
# reboot # (or: systemctl --user start … to bring up now)
[Unit]
Description=punktfunk headless KDE Plasma session (kwin --virtual on wayland-kde)
After=pipewire.service pipewire-pulse.service dbus.service
Wants=pipewire.service
[Service]
Type=simple
ExecStart=/usr/bin/bash %h/punktfunk/scripts/headless/run-headless-kde.sh 1920x1080
Restart=always
RestartSec=3
[Install]
WantedBy=default.target