summaryrefslogtreecommitdiff
path: root/dotfiles/hyprland/.local/bin/waybar-layout
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/hyprland/.local/bin/waybar-layout')
-rwxr-xr-xdotfiles/hyprland/.local/bin/waybar-layout52
1 files changed, 17 insertions, 35 deletions
diff --git a/dotfiles/hyprland/.local/bin/waybar-layout b/dotfiles/hyprland/.local/bin/waybar-layout
index 7ffb8a8..6c45877 100755
--- a/dotfiles/hyprland/.local/bin/waybar-layout
+++ b/dotfiles/hyprland/.local/bin/waybar-layout
@@ -1,54 +1,36 @@
#!/bin/sh
# Hyprland layout indicator for waybar
# Shows current layout with nerd font icons
+# Layouts: master -> tab group (monocle) -> scrolling -> floating
# Get current layout
LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str')
-# Get master orientation if using master layout
-ORIENTATION=""
-if [ "$LAYOUT" = "master" ]; then
- ORIENTATION=$(hyprctl getoption master:orientation -j | jq -r '.str')
-fi
-
-# Check if active window is fullscreen (monocle)
-FULLSCREEN=$(hyprctl activewindow -j | jq -r '.fullscreen')
+# Check if workspace has allfloat enabled
+ALLFLOAT=$(hyprctl activeworkspace -j | jq -r '.hasfullscreenwindow')
# Check if active window is floating
-FLOATING=$(hyprctl activewindow -j | jq -r '.floating')
+FLOATING=$(hyprctl activewindow -j 2>/dev/null | jq -r '.floating // false')
+
+# Check workspace rules for allfloat
+WSRULES=$(hyprctl activeworkspace -j | jq -r '.rules // []')
# Determine icon and tooltip
-if [ "$FULLSCREEN" = "2" ] || [ "$FULLSCREEN" = "1" ]; then
- ICON="󰊓"
- TOOLTIP="Monocle (fullscreen)"
-elif [ "$FLOATING" = "true" ]; then
+if [ "$LAYOUT" = "master" ] && echo "$WSRULES" | grep -q "allfloat"; then
ICON="󰖲"
TOOLTIP="Floating"
-elif [ "$LAYOUT" = "dwindle" ]; then
- ICON="󱒎"
- TOOLTIP="Dwindle"
+elif [ "$LAYOUT" = "scrolling" ]; then
+ ICON="󰯍"
+ TOOLTIP="Scrolling"
+elif [ "$LAYOUT" = "hy3" ]; then
+ ICON="󰖯"
+ TOOLTIP="Tab Group (Monocle)"
elif [ "$LAYOUT" = "master" ]; then
- case "$ORIENTATION" in
- left)
- ICON="󰕰"
- TOOLTIP="Master (left)"
- ;;
- top)
- ICON="󱂩"
- TOOLTIP="Master (top)"
- ;;
- center)
- ICON="󰘸"
- TOOLTIP="Master (center)"
- ;;
- *)
- ICON="󰕰"
- TOOLTIP="Master"
- ;;
- esac
+ ICON="󰕰"
+ TOOLTIP="Master"
else
ICON="󰕰"
- TOOLTIP="Unknown"
+ TOOLTIP="$LAYOUT"
fi
echo "{\"text\": \"<span size='large'>$ICON</span>\", \"tooltip\": \"$TOOLTIP\"}"