fix: share reliable virtual key delivery across Linux rigs
This commit is contained in:
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user