blob: e6dbbb9c012252b72d67713a8d9470ff843d6064 (
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
|
#!/bin/dash
# loads colors
. ~/.cache/wal/colors.sh
SEPARATOR=" "
# default color button
use() {
printf "%s^c%s^^b%s^ %s ^b%s^ %s ^b%s^" "$SEPARATOR" "$background" "$color1" "$1" "$color9" "$2" "$background"
}
# show in specified color if specified condition is true
usecolorif() {
if [ "$3" = "1" ]; then
printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$color1" "$background" "$1" "$color9" "$color0" "$2" "$background"
else
use "$1" "$2"
fi
}
# only show if content is not zero
useif() {
if [ -n "$2" ]; then
use "$1" "$2"
fi
}
# actual string
echo "\
$(useif "" "$(updates read)")\
$(useif "" "$(mute shortstatus)")\
$(useif "" "$(volume)")\
$(useif "說" "$(network)")\
$(use "" "$(load) | $(temp)")\
$(use "" "$(battery)")\
$(use "" "$(datetime)")\
"
|