Files
nixos/Droidnix/generated/.config/waybar/scripts/hyprscroll-overflow.sh
T
2026-04-01 19:01:40 +02:00

27 lines
972 B
Bash

#!/usr/bin/env bash
# Get active workspace
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
# Get workspace info
ws=$(hyprctl workspaces -j | jq ".[] | select(.id==$active_ws)")
# Layout (requires hyprscroll plugin)
layout=$(echo "$ws" | jq -r '.layout // "unknown"')
# Window count
clients=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$active_ws)]")
count=$(echo "$clients" | jq 'length')
# Visible windows (heuristic: fullscreen or floating doesn't matter, we count all)
# If you use hyprscroll, visible windows ≈ 1 (current focus)
visible=1
# Build tooltip (list all windows)
tooltip=$(echo "$clients" | jq -r '.[].title' | sed ':a;N;$!ba;s/\n/\\n/g')
# Conditions
if [[ "$layout" != "scrolling" ]]; then
echo '{"text": "", "class": "hidden"}'
exit 0
fi
if (( count <= visible )); then
echo '{"text": "", "class": "hidden"}'
exit 0
fi
# Output star + count
echo "{\"text\": \"★ $count\", \"tooltip\": \"$tooltip\", \"class\": \"overflow\"}"