blob: b364c189c5a7cea7c68850d6856b2031edbe1bf3 (
plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#!/bin/bash
stats=(
cpu.top
cpu.percent
cpu.sys
cpu.user
memory
disk
network.up
network.down
)
hide_stats() {
args=()
for item in "${stats[@]}"; do
args+=(--set "$item" drawing=off)
done
sketchybar "${args[@]}" \
--set separator_right \
icon= \
icon.font.size=25 \
padding_right=10
}
show_stats() {
args=()
for item in "${stats[@]}"; do
args+=(--set "$item" drawing=on)
done
sketchybar "${args[@]}" \
--set separator_right \
icon= \
icon.font.size=25 \
padding_right=10
}
toggle_stats() {
state=$(sketchybar --query separator_right | jq -r .icon.value)
case $state in
"")
show_stats
;;
"")
hide_stats
;;
esac
}
case "$SENDER" in
"hide_stats")
hide_stats
;;
"show_stats")
show_stats
;;
"toggle_stats")
toggle_stats
;;
esac
|