diff options
Diffstat (limited to 'dotfiles/hyprland/.local/bin/layout-navigate')
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/layout-navigate | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/layout-navigate b/dotfiles/hyprland/.local/bin/layout-navigate new file mode 100755 index 0000000..4fc02c2 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/layout-navigate @@ -0,0 +1,59 @@ +#!/bin/sh +# Layout-aware navigation for Hyprland +# Usage: layout-navigate <direction> [move] +# direction: next|prev +# move: if present, move window instead of focus + +DIR="$1" +MOVE="$2" +LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str') + +case "$LAYOUT" in + scrolling) + # Swap directions: J (next) goes left, K (prev) goes right + if [ "$MOVE" = "move" ]; then + if [ "$DIR" = "next" ]; then + hyprctl dispatch layoutmsg movewindowto l + else + hyprctl dispatch layoutmsg movewindowto r + fi + else + if [ "$DIR" = "next" ]; then + hyprctl dispatch layoutmsg focus l + else + hyprctl dispatch layoutmsg focus r + fi + fi + ;; + hy3) + if [ "$MOVE" = "move" ]; then + if [ "$DIR" = "next" ]; then + hyprctl dispatch hy3:movewindow r + else + hyprctl dispatch hy3:movewindow l + fi + else + if [ "$DIR" = "next" ]; then + hyprctl dispatch hy3:movefocus r + else + hyprctl dispatch hy3:movefocus l + fi + fi + ;; + *) + # master, dwindle, etc. + if [ "$MOVE" = "move" ]; then + if [ "$DIR" = "next" ]; then + hyprctl dispatch layoutmsg swapnext + else + hyprctl dispatch layoutmsg swapprev + fi + else + if [ "$DIR" = "next" ]; then + hyprctl dispatch layoutmsg cyclenext + else + hyprctl dispatch layoutmsg cycleprev + fi + fi + ;; +esac |
