blob: 6c45877a67cdff59c3274169c54e05ab53a3b878 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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\"}"
|