From 5477bf4a366dd2038b144aa542ce3785f205f368 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 24 Apr 2026 07:36:47 -0500 Subject: 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/. ``` --- tests/layout-navigate/fake-hyprctl | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 tests/layout-navigate/fake-hyprctl (limited to 'tests/layout-navigate/fake-hyprctl') 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 -- cgit v1.2.3