Regenerated
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# ~/.config/waybar/scripts/hypr-workspaces.sh
|
||||
|
||||
# Example: count windows and generate tooltip
|
||||
win_count=4
|
||||
tooltip="• scripts - Thunar\n• Droidnix — config\n• Waybar Workspace Customization — Zen Browser\n• henrov@traveldroid: ~/.config/waybar/scripts"
|
||||
|
||||
# Output compact JSON
|
||||
jq -c -n --arg text "$win_count" --arg tooltip "$tooltip" '{text: $text, tooltip: $tooltip}'
|
||||
# Get active workspace ID
|
||||
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
# Get clients in active workspace
|
||||
clients=$(hyprctl clients -j | jq -r \
|
||||
".[] | select(.workspace.id==$active_ws) | \"\(.title)\"")
|
||||
# Count clients
|
||||
count=$(echo "$clients" | grep -c .)
|
||||
# If no clients → hide module
|
||||
if [ "$count" -eq 0 ]; then
|
||||
jq -c -n '{text:"", class:"hidden"}'
|
||||
exit 0
|
||||
fi
|
||||
# Build tooltip (newline separated)
|
||||
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
|
||||
# Output JSON
|
||||
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