blob: 3c501720b854e5b824c741c5f9b1aabee8ebbb23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/sh
# Emit waybar JSON with the mako notification count. Falls back to 0 when
# mako is not running so waybar doesn't blink errors.
set -eu
if ! command -v makoctl >/dev/null 2>&1; then
printf '{"text":"","tooltip":"mako not installed","class":"off"}\n'
exit 0
fi
count=$(makoctl history 2>/dev/null |
grep -c '"summary"' || true)
pending=$(makoctl list 2>/dev/null |
grep -c '"summary"' || true)
if [ "$pending" -gt 0 ]; then
text="NTF !$pending"
class="pending"
elif [ "$count" -gt 0 ]; then
text="NTF $count"
class="history"
else
text="NTF 0"
class="empty"
fi
printf '{"text":"%s","tooltip":"%s pending / %s history","class":"%s"}\n' \
"$text" "$pending" "$count" "$class"
|