Files
punktfunk/scripts/headless/run-headless-sway.sh
enricobuehler bfd64ce871
ci / rust (push) Has been cancelled
rename: lumen → punktfunk, everywhere
Full project rename, decided 2026-06-10:
- Crates/binaries: punktfunk-core / punktfunk-host / punktfunk-client-rs.
- C ABI: punktfunk_* symbols, Punktfunk* types, include/punktfunk_core.h,
  PUNKTFUNK_FEATURE_QUIC guard (header regenerated; cbindgen renames updated, incl.
  PUNKTFUNK_BTN_*/PUNKTFUNK_AXIS_* wire constants).
- Protocol: punktfunk/1 — control-plane magic LMN1 → PKF1, nonce salt lmn1 → pkf1.
  WIRE BREAK: clients must be rebuilt from this revision.
- Env knobs: PUNKTFUNK_VIDEO_SOURCE / PUNKTFUNK_COMPOSITOR / PUNKTFUNK_ZEROCOPY / ….
- Host config dir: ~/.config/punktfunk (the box's dir was migrated in place — the
  persistent identity is unchanged, pinned fingerprints stay valid).
- Swift package: PunktfunkKit + PunktfunkCore.xcframework + PunktfunkConnection
  (Sources/PunktfunkClient app + tests renamed with it); build-xcframework.sh updated.
- scripts/: 60-punktfunk.rules, punktfunk-host.service; OpenAPI doc regenerated.

Also: scripts/headless/run-headless-kde.sh — full headless Plasma bringup. Root cause of
"desktop but no apps/settings" over the stream: plasmashell launched without
XDG_MENU_PREFIX=plasma-, so the launcher resolved a nonexistent applications.menu and
rendered an empty menu. The script sets the complete KDE session env (menu prefix,
KDE_FULL_SESSION, session version) and rebuilds ksycoca before starting plasmashell.

Gate: 97/97 tests, clippy -D warnings (both feature sets), fmt, C-ABI harness PASS,
zero lumen references left outside .git.

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

36 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Launch headless Sway on the NVIDIA box for the punktfunk M0 capture spike.
#
# Runs on the user's *shared* session bus (NOT a private dbus-run-session) so that the
# ScreenCast portal (xdg-desktop-portal-wlr) and the punktfunk host share one bus. After this
# is up, run `prepare-session.sh` from a second shell to set the mode + portal env.
#
# Prereqs (see docs/linux-setup.md / scripts/bootstrap-ubuntu.sh):
# - nvidia-drm.modeset=Y
# - the NVIDIA GL/EGL userspace (libnvidia-gl-NNN) — provides libEGL_nvidia + the GLVND
# vendor JSON; without it wlroots can't init EGL on the GPU and falls back to pixman,
# which the ScreenCast portal cannot capture.
# - membership in the `render` + `video` groups (re-login after `usermod -aG`).
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091
source "$HERE/env.sh"
export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=$XDG_RUNTIME_DIR/bus}"
mkdir -p "$XDG_RUNTIME_DIR" 2>/dev/null || true
chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null || true
echo "starting headless Sway (renderer=$WLR_RENDERER) on bus $DBUS_SESSION_BUS_ADDRESS"
echo "from another shell on this user: bash $HERE/prepare-session.sh"
echo
# wlroots opens the render node (/dev/dri/renderD128, group 'render'); NVIDIA's EGL uses it.
# If this login predates `usermod -aG render,video` (groups not yet active), bridge with
# `sg render` for this launch. The clean fix is to re-login so the groups apply natively.
if id -nG | tr ' ' '\n' | grep -qx render; then
exec sway --unsupported-gpu
else
echo "note: 'render' group not active in this login — bridging via 'sg render' (re-login to avoid)"
exec sg render -c 'sway --unsupported-gpu'
fi