18 lines
592 B
Bash
18 lines
592 B
Bash
#!/usr/bin/env bash
|
|
# ~/.config/waybar/scripts/active-workspace-wincount-json.sh
|
|
|
|
# Get active workspace ID
|
|
active_ws_id=$(hyprctl activewindow | grep "workspace: " | cut -d' ' -f2)
|
|
|
|
# Get all clients on that workspace
|
|
clients=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id==$active_ws_id) | .title")
|
|
|
|
# Count windows
|
|
win_count=$(echo "$clients" | wc -l | tr -d ' ')
|
|
|
|
# Build tooltip string (each window on a new line)
|
|
tooltip=$(echo "$clients" | sed 's/^/• /')
|
|
|
|
# Output JSON for Waybar
|
|
jq -n --arg count "$win_count" --arg tooltip "$tooltip" '{text: $count, tooltip: $tooltip}'
|