Regenerated

This commit is contained in:
2026-04-01 19:09:28 +02:00
parent 767ceb2f56
commit ee8680c5f6
4 changed files with 377 additions and 355 deletions
+3 -2
View File
@@ -22,16 +22,17 @@
"battery",
"tray",
"clock",
"custom/notifications",
# "custom/notifications",
],
"custom/hyprscroll_overflow": {
"exec": "~/.config/waybar/scripts/hyprscroll-overflow.sh",
"interval": 2,
"return-type": "json",
"format": "{}",
"on-click": "~/.config/waybar/scripts/hyprscroll-menu.sh",
"tooltip": true
},
},,
/*
"custom/notifications": {
@@ -1,26 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
# Fallback output
fallback='{"text":" ","class":"hidden"}'
# Get active workspace
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
active_ws=$(hyprctl activeworkspace -j 2>/dev/null | jq -r '.id' 2>/dev/null) || {
echo "$fallback"
exit 0
}
# 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)
ws=$(hyprctl workspaces -j 2>/dev/null | jq ".[] | select(.id==$active_ws)" 2>/dev/null) || {
echo "$fallback"
exit 0
}
# Layout
layout=$(echo "$ws" | jq -r '.layout // "unknown"' 2>/dev/null)
# Clients
clients=$(hyprctl clients -j 2>/dev/null | jq "[.[] | select(.workspace.id==$active_ws)]" 2>/dev/null) || {
echo "$fallback"
exit 0
}
count=$(echo "$clients" | jq 'length' 2>/dev/null)
# In scrolling layout, only 1 is visible
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"}'
if [[ "$layout" != "scrolling" ]] || (( count <= visible )); then
echo "$fallback"
exit 0
fi
if (( count <= visible )); then
echo '{"text": "", "class": "hidden"}'
exit 0
fi
# Output star + count
echo "{\"text\": \"★ $count\", \"tooltip\": \"$tooltip\", \"class\": \"overflow\"}"
# Tooltip (safe escaping)
tooltip=$(echo "$clients" | jq -r '.[].title' 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g')
# Final output
echo "{\"text\":\"★ $count\",\"tooltip\":\"$tooltip\",\"class\":\"overflow\"}"