blob: 661b60fc955494259ef1254f2daa42a898a29448 (
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
|
#!/bin/dash
# echo 0; exit 0
# 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" "$primary" "$1" "$accent" "$2" "$background"
}
flash() {
second="$(date +'%s')"
if [ "$3" = "1" ]; then
if [ $((second % 2)) = 1 ]; then
printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$color1" "$background" "$1" "$color1" "$background" "$2" "$background"
else
printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$background" "$color1" "$1" "$background" "$color1" "$2" "$background"
fi
else
echo ""
fi
}
# 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" "$primary" "$background" "$1" "$accent" "$background" "$2" "$background"
else
echo ""
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)")\
$(flash "" "$(ischarging)" "$(ischarging > /dev/null; echo $?)")\
$(use "" "$(datetime)")\
"
# $(use "" "$(battery)")\
|