From b6f8f16108a8cfe3f1546a01fce8d948404ab0c8 Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 27 Oct 2026 03:12:16 +0300 Subject: [PATCH] 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 --- spikes/gpui/headless-wayland.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spikes/gpui/headless-wayland.sh b/spikes/gpui/headless-wayland.sh index 34d926b..34cd6a1 100755 --- a/spikes/gpui/headless-wayland.sh +++ b/spikes/gpui/headless-wayland.sh @@ -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"