summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/layout-cycle
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-03-07 14:03:02 -0600
committerCraig Jennings <c@cjennings.net>2026-03-07 14:03:02 -0600
commitdd543e3b2c42dc4706ee016bb4ae376d9e981272 (patch)
tree3062599122147bd588f37cf32c18aeb15ef0dd84 /dotfiles/hyprland/.local/bin/layout-cycle
parentde287500b569858d774816932fdb9a9f679c1669 (diff)
feat(hyprland): remove plugins, add layout cycling
Hyprland 0.54 brings scrolling and monocle layouts into core, making hyprpm plugins unnecessary. Remove hyprland-plugins-setup, focus-restore, hyprpm pacman hook, and allfloat keybinding. Add layout-cycle script and $mod+Shift+Arrow keybindings to cycle master/scrolling/monocle. Move cpio to System Utilities section.
Diffstat (limited to 'dotfiles/hyprland/.local/bin/layout-cycle')
-rwxr-xr-xdotfiles/hyprland/.local/bin/layout-cycle35
1 files changed, 35 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/layout-cycle b/dotfiles/hyprland/.local/bin/layout-cycle
new file mode 100755
index 0000000..dcc7b6b
--- /dev/null
+++ b/dotfiles/hyprland/.local/bin/layout-cycle
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Cycle Hyprland layout forward (next) or backward (prev)
+# Usage: layout-cycle next | layout-cycle prev
+
+LAYOUTS="master scrolling monocle"
+CURRENT=$(hyprctl getoption general:layout -j | jq -r '.str')
+DIR="${1:-next}"
+
+set -- $LAYOUTS
+COUNT=$#
+INDEX=0
+
+i=0
+for layout in $LAYOUTS; do
+ if [ "$layout" = "$CURRENT" ]; then
+ INDEX=$i
+ break
+ fi
+ i=$((i + 1))
+done
+
+if [ "$DIR" = "next" ]; then
+ INDEX=$(( (INDEX + 1) % COUNT ))
+else
+ INDEX=$(( (INDEX - 1 + COUNT) % COUNT ))
+fi
+
+i=0
+for layout in $LAYOUTS; do
+ if [ $i -eq $INDEX ]; then
+ hyprctl keyword general:layout "$layout"
+ break
+ fi
+ i=$((i + 1))
+done