From 2d75b3ea4dc6d58b476e9ca435639cf5a6dacd60 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 7 Mar 2026 11:18:18 -0600 Subject: feat(hyprland): add monocle layout support, fix scrolling keybindings Add monocle to layout cycle and waybar indicator. Fix scrolling layout move (swapwindow) and resize (resizeactive). Add layout-resize script. --- dotfiles/hyprland/.local/bin/cycle-layout | 5 ++++- dotfiles/hyprland/.local/bin/layout-navigate | 6 +++--- dotfiles/hyprland/.local/bin/layout-resize | 24 ++++++++++++++++++++++++ dotfiles/hyprland/.local/bin/waybar-layout | 5 ++++- 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100755 dotfiles/hyprland/.local/bin/layout-resize (limited to 'dotfiles/hyprland/.local/bin') diff --git a/dotfiles/hyprland/.local/bin/cycle-layout b/dotfiles/hyprland/.local/bin/cycle-layout index a632142..310c182 100755 --- a/dotfiles/hyprland/.local/bin/cycle-layout +++ b/dotfiles/hyprland/.local/bin/cycle-layout @@ -1,6 +1,6 @@ #!/bin/sh # Cycle through Hyprland layouts -# Cycle: master -> scrolling -> floating -> master +# 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') @@ -11,6 +11,9 @@ case "$LAYOUT" in 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 diff --git a/dotfiles/hyprland/.local/bin/layout-navigate b/dotfiles/hyprland/.local/bin/layout-navigate index 085df22..07f748a 100755 --- a/dotfiles/hyprland/.local/bin/layout-navigate +++ b/dotfiles/hyprland/.local/bin/layout-navigate @@ -10,12 +10,12 @@ LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str') case "$LAYOUT" in scrolling) - # Swap directions: J (next) goes left, K (prev) goes right + # J (next) goes left, K (prev) goes right if [ "$MOVE" = "move" ]; then if [ "$DIR" = "next" ]; then - hyprctl dispatch layoutmsg movewindowto l + hyprctl dispatch swapwindow l else - hyprctl dispatch layoutmsg movewindowto r + hyprctl dispatch swapwindow r fi else if [ "$DIR" = "next" ]; then diff --git a/dotfiles/hyprland/.local/bin/layout-resize b/dotfiles/hyprland/.local/bin/layout-resize new file mode 100755 index 0000000..c7e0151 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/layout-resize @@ -0,0 +1,24 @@ +#!/bin/sh +# Layout-aware resize for Hyprland +# Usage: layout-resize + +DIR="$1" +LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str') + +case "$LAYOUT" in + scrolling) + if [ "$DIR" = "grow" ]; then + hyprctl dispatch resizeactive 50 0 + else + hyprctl dispatch resizeactive -50 0 + fi + ;; + *) + # master, dwindle, etc. + if [ "$DIR" = "grow" ]; then + hyprctl dispatch splitratio 0.05 + else + hyprctl dispatch splitratio -0.05 + fi + ;; +esac diff --git a/dotfiles/hyprland/.local/bin/waybar-layout b/dotfiles/hyprland/.local/bin/waybar-layout index 1750eff..083e9ef 100755 --- a/dotfiles/hyprland/.local/bin/waybar-layout +++ b/dotfiles/hyprland/.local/bin/waybar-layout @@ -1,7 +1,7 @@ #!/bin/sh # Hyprland layout indicator for waybar # Shows current layout with nerd font icons -# Layouts: master -> scrolling -> floating +# Layouts: master -> scrolling -> monocle -> floating # Check if hyprctl is reachable if ! hyprctl version >/dev/null 2>&1; then @@ -22,6 +22,9 @@ if [ "$LAYOUT" = "master" ] && echo "$WSRULES" | grep -q "allfloat"; then elif [ "$LAYOUT" = "scrolling" ]; then ICON="󰯍" TOOLTIP="Scrolling" +elif [ "$LAYOUT" = "monocle" ]; then + ICON="󰊓" + TOOLTIP="Monocle" elif [ "$LAYOUT" = "master" ]; then ICON="󰕰" TOOLTIP="Master" -- cgit v1.2.3