15 lines
404 B
Bash
15 lines
404 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Get active workspace ID
|
|
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
|
|
|
|
# Count clients in the active workspace
|
|
clients=$(hyprctl -j clients | jq --argjson w "$active_ws" '[.[] | select(.workspace.id==$w)] | length')
|
|
|
|
# Output valid JSON for Waybar
|
|
if [ "$clients" -eq 0 ]; then
|
|
echo "{\"text\":\"$active_ws\"}"
|
|
else
|
|
echo "{\"text\":\"$active_ws ★ $clients\"}"
|
|
fi
|