diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-24 07:36:47 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-24 07:36:47 -0500 |
| commit | 5477bf4a366dd2038b144aa542ce3785f205f368 (patch) | |
| tree | 4297b04984310e6b2f3730e5df8e6f9cca62ab4f /tests/layout-navigate/fake-hyprctl | |
| parent | a0e3a6ffadd867153587b77bcf8727fdd34c5f7a (diff) | |
| download | archsetup-5477bf4a366dd2038b144aa542ce3785f205f368.tar.gz archsetup-5477bf4a366dd2038b144aa542ce3785f205f368.zip | |
fix(hyprland): Escape special workspace on navigate
When focus is inside a special workspace (e.g. special:stash),
layoutmsg cyclenext/cycleprev only operates within that workspace,
trapping $mod+J inside the scratchpad overlay.
Detect workspace name starting with "special:" on focus navigation
(not move), toggle the overlay off first, re-read active window
state, then fall through to the normal layout/floating branches.
Add unit tests with a fake hyprctl harness in
tests/layout-navigate/. ```
Diffstat (limited to 'tests/layout-navigate/fake-hyprctl')
| -rwxr-xr-x | tests/layout-navigate/fake-hyprctl | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/layout-navigate/fake-hyprctl b/tests/layout-navigate/fake-hyprctl new file mode 100755 index 0000000..701f397 --- /dev/null +++ b/tests/layout-navigate/fake-hyprctl @@ -0,0 +1,48 @@ +#!/bin/sh +# Fake hyprctl for testing layout-navigate. +# +# State files live in $FAKE_HYPR_DIR: +# activewindow.json - first activewindow call returns this +# activewindow.1.json - second call (after togglespecialworkspace) returns this, if present +# layout.json - getoption general:layout returns this +# dispatch.log - every "dispatch" invocation appended here (one line) +# call-count - internal counter for activewindow calls + +: "${FAKE_HYPR_DIR:?FAKE_HYPR_DIR must be set}" + +cmd="$1" +shift + +case "$cmd" in + activewindow) + # Count calls so tests can provide a post-toggle state + count_file="$FAKE_HYPR_DIR/call-count" + count=$(cat "$count_file" 2>/dev/null || echo 0) + next=$((count + 1)) + echo "$next" > "$count_file" + + if [ "$count" -eq 0 ]; then + cat "$FAKE_HYPR_DIR/activewindow.json" + else + # Try numbered file; fall back to original + numbered="$FAKE_HYPR_DIR/activewindow.$count.json" + if [ -f "$numbered" ]; then + cat "$numbered" + else + cat "$FAKE_HYPR_DIR/activewindow.json" + fi + fi + ;; + getoption) + cat "$FAKE_HYPR_DIR/layout.json" + ;; + dispatch) + # Log the entire dispatch invocation as one line + echo "dispatch $*" >> "$FAKE_HYPR_DIR/dispatch.log" + echo "ok" + ;; + *) + echo "fake-hyprctl: unknown command '$cmd'" >&2 + exit 1 + ;; +esac |
