summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/cycle-layout
blob: 310c1822584e9a08dfb06c1a7e04dd8e55b30798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# Cycle through Hyprland layouts
# Cycle: master -> scrolling -> monocle -> floating -> master

LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str')
FLOATING=$(hyprctl activewindow -j 2>/dev/null | jq -r '.floating // false')

# Check if we're in "all floating" mode by checking layout
case "$LAYOUT" in
    master)
        hyprctl keyword general:layout scrolling
        ;;
    scrolling)
        hyprctl keyword general:layout monocle
        ;;
    monocle)
        # Switch to master but float all windows
        hyprctl keyword general:layout master
        hyprctl dispatch workspaceopt allfloat
        ;;
    *)
        # Return to master tiled
        hyprctl dispatch workspaceopt allfloat
        hyprctl keyword general:layout master
        hyprctl keyword master:orientation left
        ;;
esac