Regenerated
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Get focused monitor name
|
||||
focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused==true) | .name')
|
||||
monitor="${WAYBAR_OUTPUT_NAME:-$focused_monitor}"
|
||||
|
||||
# Hide if not focused monitor
|
||||
if [ "$monitor" != "$focused_monitor" ]; then
|
||||
jq -c -n '{text:"", class:"hidden"}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get active workspace on this monitor
|
||||
active_ws=$(hyprctl monitors -j | jq -r \
|
||||
".[] | select(.name==\"$monitor\") | .activeWorkspace.id")
|
||||
|
||||
# Get clients
|
||||
clients=$(hyprctl clients -j | jq -r \
|
||||
".[] | select(.workspace.id==$active_ws) | \"\(.title)\"")
|
||||
|
||||
count=$(echo "$clients" | grep -c '\S')
|
||||
|
||||
# Hide if 0 or 1 clients — no point showing window switcher
|
||||
if [ "$count" -le 1 ]; then
|
||||
jq -c -n '{text:"", class:"hidden"}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
|
||||
|
||||
jq -c -n \
|
||||
--arg text "$count" \
|
||||
--arg tooltip "$tooltip" \
|
||||
--arg class "active" \
|
||||
'{text:$text, tooltip:$tooltip, class:$class}'
|
||||
Reference in New Issue
Block a user