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/. ``` --- dotfiles/hyprland/.local/bin/layout-navigate | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'dotfiles') diff --git a/dotfiles/hyprland/.local/bin/layout-navigate b/dotfiles/hyprland/.local/bin/layout-navigate index 352db79..89af45f 100755 --- a/dotfiles/hyprland/.local/bin/layout-navigate +++ b/dotfiles/hyprland/.local/bin/layout-navigate @@ -6,9 +6,27 @@ DIR="$1" MOVE="$2" -FLOATING=$(hyprctl activewindow -j | jq -r '.floating') + +ACTIVE_JSON=$(hyprctl activewindow -j) +FLOATING=$(echo "$ACTIVE_JSON" | jq -r '.floating') +WS_NAME=$(echo "$ACTIVE_JSON" | jq -r '.workspace.name') LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str') +# If the active window is in a special workspace (scratchpad overlay) and we +# are navigating focus (not moving), hide the overlay first. layoutmsg/cyclenext +# cannot cross the overlay→regular boundary, so without this the $mod+J key +# gets trapped inside the scratchpad. +case "$WS_NAME" in + special:*) + if [ "$MOVE" != "move" ]; then + hyprctl dispatch togglespecialworkspace "${WS_NAME#special:}" + # Re-read state: focus has moved to the regular workspace. + ACTIVE_JSON=$(hyprctl activewindow -j) + FLOATING=$(echo "$ACTIVE_JSON" | jq -r '.floating') + fi + ;; +esac + # If current window is floating, use cyclenext to reach tiled windows if [ "$FLOATING" = "true" ] && [ "$MOVE" != "move" ]; then if [ "$DIR" = "next" ]; then -- cgit v1.2.3