summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/cycle-layout
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/hyprland/.local/bin/cycle-layout')
-rwxr-xr-xdotfiles/hyprland/.local/bin/cycle-layout30
1 files changed, 30 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/cycle-layout b/dotfiles/hyprland/.local/bin/cycle-layout
new file mode 100755
index 0000000..a3b1b1a
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/cycle-layout
@@ -0,0 +1,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