Give Input keycaps, a shortcut search, and the missing pointer basics
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -18,6 +18,9 @@ set -euo pipefail
|
||||
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
harness="$repo_dir/config/dot/quickshell/keybinds-harness.qml"
|
||||
service="$repo_dir/config/dot/quickshell/services/Keybinds.qml"
|
||||
settings_dir="$repo_dir/config/dot/quickshell/modules/settings"
|
||||
page="$settings_dir/ShortcutsPage.qml"
|
||||
row="$settings_dir/ShortcutRow.qml"
|
||||
|
||||
fail() {
|
||||
printf 'keybind rebind contract: %s\n' "$1" >&2
|
||||
@@ -29,6 +32,61 @@ rg -Fq 'function overrideOccupantFor(chord: string, exceptShipped: string): stri
|
||||
rg -Fq 'root.overrideOccupantFor(shipped, shipped)' "$service" \
|
||||
|| fail 'resetBind does not check whether another override occupies its shipped chord'
|
||||
|
||||
# ── The page that drives all of the above ────────────────────────────────────
|
||||
#
|
||||
# The engine is exercised for real below, but the engine is only reachable
|
||||
# through one screen, and the screen has been rebuilt around a per-row
|
||||
# component. These pin the parts of that screen that carry consequence: every
|
||||
# one of them is a way to lose the rebinding flow without any test noticing,
|
||||
# because the service would still be perfectly correct.
|
||||
#
|
||||
# The row and the page are read as one source, so moving a control between them
|
||||
# is not a failure -- removing it is.
|
||||
|
||||
[[ -r "$page" ]] || fail "cannot read $page"
|
||||
[[ -r "$row" ]] || fail "cannot read $row -- the shortcut row component is gone"
|
||||
browser="$(cat "$page" "$row")"
|
||||
|
||||
# The capture field is shared with nothing else and is the only thing in the
|
||||
# tree that reads a chord without acting on it. A page that grew its own key
|
||||
# handler instead would capture SUPER as a bind of its own.
|
||||
grep -Fq 'ShortcutCapture' <<<"$browser" \
|
||||
|| fail 'the shortcuts browser no longer uses ShortcutCapture, so something else is reading key presses'
|
||||
|
||||
for needle in \
|
||||
'Keybinds.boundTo(' \
|
||||
'Keybinds.rebind(' \
|
||||
'Keybinds.resetBind(' \
|
||||
'Keybinds.resetAll()' \
|
||||
'Keybinds.isOverridden(' \
|
||||
'text: "Change"' \
|
||||
'text: "Reset"'; do
|
||||
grep -Fq "$needle" <<<"$browser" \
|
||||
|| fail "the shortcuts browser is missing $needle"
|
||||
done
|
||||
|
||||
# boundTo before rebind. Without the check the write still succeeds and two
|
||||
# actions end up on one chord, with whichever Hyprland reads last winning.
|
||||
conflict_line="$(grep -n 'Keybinds.boundTo(' <<<"$browser" | head -1 | cut -d: -f1)"
|
||||
write_line="$(grep -n 'Keybinds.rebind(' <<<"$browser" | head -1 | cut -d: -f1)"
|
||||
[[ -n "$conflict_line" && -n "$write_line" && "$conflict_line" -lt "$write_line" ]] \
|
||||
|| fail 'the chord in use is not checked before the rebind is written'
|
||||
|
||||
# Keyed by the shipped Lua chord, never by the description. Keying by
|
||||
# description is what once moved every bind that shared one, silently costing
|
||||
# the XF86Calculator hardware key when SUPER+C was rebound.
|
||||
grep -Fq 'luaChord' <<<"$browser" \
|
||||
|| fail 'the browser does not identify binds by their shipped Lua chord'
|
||||
if grep -qE 'Keybinds\.(rebind|resetBind)\([^)]*description' <<<"$browser"; then
|
||||
fail 'a rebind or reset is keyed by description, which moves every bind that shares one'
|
||||
fi
|
||||
|
||||
# Restoring everything stays reachable, and says how much it would undo.
|
||||
rg -Fq 'Restore every shipped shortcut' "$page" \
|
||||
|| fail 'the restore-all row is gone'
|
||||
rg -Fq 'Object.keys(Keybinds.overrides).length' "$page" \
|
||||
|| fail 'the restore-all row no longer counts what it would put back'
|
||||
|
||||
if [[ "${PANAMA_KEYBINDS_STATIC_ONLY:-0}" == "1" ]]; then
|
||||
printf 'keybind rebind contract: PASS (static)\n'
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user