summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/cycle-layout
blob: a3b1b1ac43fbfb639bd8468ef4b643c0512785e5 (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
28
29
30
#!/bin/sh
# Cycle through Hyprland layouts

LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str')
ORIENTATION=""

if [ "$LAYOUT" = "master" ]; then
    ORIENTATION=$(hyprctl getoption master:orientation -j | jq -r '.str')
fi

# Cycle: master-left -> master-top -> master-center -> dwindle -> master-left
if [ "$LAYOUT" = "dwindle" ]; then
    hyprctl keyword general:layout master
    hyprctl keyword master:orientation left
elif [ "$LAYOUT" = "master" ]; then
    case "$ORIENTATION" in
        left)
            hyprctl keyword master:orientation top
            ;;
        top)
            hyprctl keyword master:orientation center
            ;;
        center)
            hyprctl keyword general:layout dwindle
            ;;
        *)
            hyprctl keyword master:orientation left
            ;;
    esac
fi