spikes/gpui: headless-wayland.sh stops its compositor

nixpkgs' sway wrapper runs sway under a dbus-run-session of its own when
no session bus is set, so the script's kill reached dbus-run-session and
every run left a headless sway behind. It now runs sway-unwrapped, which
is the process it kills, and clears sockets a dead compositor left in its
private runtime directory before it waits for the new one's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 03:12:16 +03:00
1 parent f9f95dbf0d
commit b6f8f16108
1 file changed
+6 -1
+6 -1
View File
@@ -29,8 +29,13 @@ SPIKE_STATE=${SPIKE_STATE:-$root/.scratch/gpui-spikes-state}
runtime=$root/.scratch/wl
mkdir -p "$runtime" "$SPIKE_STATE/config" "$SPIKE_STATE/data" "$SPIKE_STATE/cache" "$SPIKE_STATE/state"
chmod 700 "$runtime"
# A compositor that died uncleanly leaves its socket, which the wait below
# would take for the new one's.
rm -f "$runtime"/wayland-* "$runtime"/sway-ipc.*
# sway-unwrapped: nixpkgs' sway wrapper starts sway under a dbus-run-session
# of its own when no bus is set, and that child outlives the kill below.
tools=$(nix build --option substituters "https://cache.nixos.org/ https://nix-community.cachix.org" \
--no-link --print-out-paths nixpkgs#sway nixpkgs#wtype)
--no-link --print-out-paths nixpkgs#sway-unwrapped nixpkgs#wtype)
for t in $tools; do PATH="$t/bin:$PATH"; done
unset DISPLAY WAYLAND_DISPLAY WAYLAND_SOCKET XDG_SESSION_TYPE DBUS_SESSION_BUS_ADDRESS SWAYSOCK
export XDG_RUNTIME_DIR="$runtime" XDG_CONFIG_HOME="$SPIKE_STATE/config"