fix: share reliable virtual key delivery across Linux rigs
Rust checks / windows-cross-check (push) Successful in 1m6s
Rust checks / linux (push) Failing after 5m44s

This commit is contained in:
2026-10-08 19:38:35 +02:00
parent dd016f7727
commit 178c400eeb
4 changed files with 54 additions and 15 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ export CLIPBIN_CLIPS_REPO="${repo}" CLIPBIN_CLIPS_OUT="${out}"
"${repo}/scripts/rig/headless.sh" bash <<'INNER'
set -euo pipefail
repo="${CLIPBIN_CLIPS_REPO}"; out="${CLIPBIN_CLIPS_OUT}"
source "${repo}/scripts/rig/keys.sh"
export XDG_DATA_HOME="${out}/data" XDG_CONFIG_HOME="${out}/config"
mkdir -p "${XDG_CONFIG_HOME}/clipbin"
cat > "${XDG_CONFIG_HOME}/clipbin/settings.json" <<'JSON'
@@ -34,12 +35,12 @@ quit_app() {
read -r qx qy qw qh < <(geometry)
click "$((qx+qw-30))" "$((qy+100))"
sleep 0.5
wtype -M ctrl -k q -m ctrl
rig_key q ctrl
for attempt in $(seq 20); do
if ! kill -0 "${app}" 2>/dev/null; then wait "${app}"; return; fi
if ((attempt % 4 == 0)); then
swaymsg '[app_id="dev.clipbin.Clipbin"] focus' >/dev/null
wtype -M ctrl -k q -m ctrl
rig_key q ctrl
fi
sleep 1
done
+6 -13
View File
@@ -11,6 +11,7 @@ export CLIPBIN_PLAYBACK_REPO="${repo}" CLIPBIN_PLAYBACK_OUT="${out}"
"${repo}/scripts/rig/headless.sh" bash <<'INNER'
set -euo pipefail
repo="${CLIPBIN_PLAYBACK_REPO}" out="${CLIPBIN_PLAYBACK_OUT}"
source "${repo}/scripts/rig/keys.sh"
export XDG_DATA_HOME="${out}/data" XDG_CONFIG_HOME="${out}/config" CLIPBIN_TRACE_FRAMES=1
mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}"
# ALSA's PipeWire plugin is cpal's fallback on Linux; there is no hardware card.
@@ -21,12 +22,6 @@ ctl.!default { type pipewire }
ALSA
export ALSA_CONFIG_PATH="${out}/alsa.conf"
swaymsg '[title="clipbin-test-game"] fullscreen disable' > /dev/null
send_key() {
# Destroying rig-pointer's virtual seat can clear keyboard focus in Sway.
swaymsg '[app_id="dev.clipbin.Clipbin"] focus' > /dev/null
sleep .2
timeout 10 wtype -s 200 -P "$1" -s 100 -p "$1"
}
# Timeline bounds come from GPUI's trace rather than guessed screen positions.
pointer_time() {
python3 - "$1" "$2" "$3" "${XDG_DATA_HOME}" <<'PYPOINTER'
@@ -62,7 +57,7 @@ grim "${out}/editor-open.png"
pointer_time "${out}/active.log" 1 click | "${repo}/target/debug/rig-pointer" 1920 1080
# GPUI/Wayland needs the virtual keyboard keymap to settle and a held key;
# instantaneous wtype press/release occasionally disappears before dispatch.
send_key space
rig_key space
sleep 1
grim "${out}/editor-playing-1.png"
sleep 2
@@ -76,8 +71,7 @@ print('PASS playback left recording active and generated real thumbnails')
PY
kill "${game}"; wait "${game}" 2>/dev/null || true
sleep 3
swaymsg '[app_id="dev.clipbin.Clipbin"] focus' > /dev/null
timeout 10 wtype -s 150 -M ctrl -s 100 -P q -s 100 -p q -m ctrl
rig_key q ctrl
for _ in $(seq 20); do if ! kill -0 "${app}" 2>/dev/null; then break; fi; sleep 1; done
if kill -0 "${app}" 2>/dev/null; then echo 'FAIL Ctrl+Q did not exit' >&2; exit 1; fi
wait "${app}"
@@ -110,12 +104,11 @@ grim "${out}/editor-gap.png"
pointer_time "${out}/playback.log" 1 $'scroll -1\nsleep 0.5\nscroll 1' | "${repo}/target/debug/rig-pointer" 1920 1080
pointer_time "${out}/playback.log" 2.5 click | "${repo}/target/debug/rig-pointer" 1920 1080
sleep .3
send_key Right
rig_key Right
sleep .3
send_key Left
rig_key Left
sleep .3
swaymsg '[app_id="dev.clipbin.Clipbin"] focus' > /dev/null
timeout 10 wtype -s 150 -M ctrl -s 100 -P q -s 100 -p q -m ctrl
rig_key q ctrl
for _ in $(seq 20); do if ! kill -0 "${app}" 2>/dev/null; then break; fi; sleep 1; done
if kill -0 "${app}" 2>/dev/null; then echo 'FAIL Ctrl+Q did not exit' >&2; exit 1; fi
wait "${app}"