fix(desktop): serve PipeWire in Desktop mode so screen capture works (#2446)

* fix(desktop): serve PipeWire in Desktop mode so screen capture works

* fix(desktop): preserve shared PipeWire lifecycle

* test(desktop): exercise shared PipeWire lifecycle

* fix(desktop): start PipeWire for bottom sessions

* fix(desktop): serialize shared PipeWire bundle preparation

Concurrent Steam and bottom Desktop starts unpacked the bundle into the
same staging directory and rewrote the access settings together. Hold an
exclusive lock around unpacking and access configuration, and cover the
race plus start success and failure environment handling in tests.

* fix(desktop): replace PipeWire access fragments atomically

Write each fragment to a temporary file and rename it so running daemons and clients never read a truncated file.

* fix(desktop): isolate runtime directories in concurrent PipeWire start test
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-15 12:00:27 -05:00
1 parent 03812bb3b7
commit 9a93f59fbf
4 files changed
+159 -6

No files matched your search

+6
View File
@@ -125,9 +125,15 @@ if [ "$(cat /usr/share/droiddeck/kwin-compositor 2>/dev/null)" = opengl ]; then
chmod 755 /run/droiddeck/kwin/kwin_wayland
export PATH=/run/droiddeck/kwin:$PATH
fi
if /usr/local/bin/droiddeck-pipewire start; then
eval "$(/usr/local/bin/droiddeck-pipewire env)"
else
echo "== pipewire: not running; screen capture has no picture"
fi
echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"
dbus-run-session -- startplasma-wayland
rc=$?
/usr/local/bin/droiddeck-pipewire stop
echo "== droiddeck-desktop: Plasma ended ($rc)"
if [ "$rc" -eq 0 ] && [ -z "${BL_BOTTOM_DESKTOP:-}" ]; then
/usr/local/bin/droiddeck-steam-launch bigpicture
@@ -20,9 +20,14 @@ unpack() {
{ rm -rf "$dir.new"; echo "droiddeck-pipewire: could not unpack $bundle" >&2; return 1; }
}
write_fragment() {
tmp=$1.$$
cat > "$tmp" && mv -f "$tmp" "$1" || { rm -f "$tmp"; return 1; }
}
access_config() {
mkdir -p "$dir/share/pipewire/pipewire.conf.d" "$dir/share/wireplumber/wireplumber.conf.d" || return 1
cat > "$dir/share/pipewire/pipewire.conf.d/droiddeck-access.conf" <<'EOF' || return 1
write_fragment "$dir/share/pipewire/pipewire.conf.d/droiddeck-access.conf" <<'EOF' || return 1
context.properties = {
module.access = false
}
@@ -34,7 +39,7 @@ context.modules = [
}
]
EOF
cat > "$dir/share/wireplumber/wireplumber.conf.d/droiddeck-access.conf" <<'EOF' || return 1
write_fragment "$dir/share/wireplumber/wireplumber.conf.d/droiddeck-access.conf" <<'EOF' || return 1
access.rules = [
{
matches = [ { pipewire.access = "unrestricted" } ]
@@ -54,8 +59,12 @@ env)
client_env
;;
start)
unpack || exit 1
access_config || { echo "droiddeck-pipewire: could not write the access settings" >&2; exit 1; }
mkdir -p "$(dirname "$dir")" 2>/dev/null
(
flock 9 || exit 1
unpack || exit 1
access_config || { echo "droiddeck-pipewire: could not write the access settings" >&2; exit 1; }
) 9> "$dir.lock" || exit 1
stop
mkdir -p "$state"
eval "$(client_env)"