blob: 62470aa622541e190fdabcb3ba5d0cdc089668f8 (
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
# Check if hyprctl is reachable
if ! hyprctl version >/dev/null 2>&1; then
echo '{"text": "<span size='"'"'large'"'"'></span>", "tooltip": "Hyprland not connected"}'
exit 0
fi
# Get current layout (redirect stderr to suppress connection errors)
LAYOUT=$(hyprctl getoption general:layout -j 2>/dev/null | jq -r '.str // "unknown"')
# Check workspace rules for allfloat
WSRULES=$(hyprctl activeworkspace -j 2>/dev/null | 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\"}"
|