diff options
Diffstat (limited to 'dotfiles/hyprland/.local/bin/waybar-layout')
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-layout | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.local/bin/waybar-layout b/dotfiles/hyprland/.local/bin/waybar-layout new file mode 100755 index 0000000..6c45877 --- /dev/null +++ b/dotfiles/hyprland/.local/bin/waybar-layout @@ -0,0 +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') + +# Check if workspace has allfloat enabled +ALLFLOAT=$(hyprctl activeworkspace -j | jq -r '.hasfullscreenwindow') + +# Check if active window is 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 [ "$LAYOUT" = "master" ] && echo "$WSRULES" | grep -q "allfloat"; then + ICON="" + TOOLTIP="Floating" +elif [ "$LAYOUT" = "scrolling" ]; then + ICON="" + TOOLTIP="Scrolling" +elif [ "$LAYOUT" = "hy3" ]; then + ICON="" + TOOLTIP="Tab Group (Monocle)" +elif [ "$LAYOUT" = "master" ]; then + ICON="" + TOOLTIP="Master" +else + ICON="" + TOOLTIP="$LAYOUT" +fi + +echo "{\"text\": \"<span size='large'>$ICON</span>\", \"tooltip\": \"$TOOLTIP\"}" |
