blob: fc8af11568fc9fed1e103d243fd6ee664f4362cf (
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
|
#!/bin/sh
STATUSPIPE="/tmp/xmobar_status_jrk"
NORMAL='#eee8d5'
MUTED='#cb4b16'
FGCOLOR="#657b83"
function isMuted () {
# retrieve mute status
# return an arbitrary string for true or nothing at all
echo
}
function getPercent () {
# somehow retrieve the percent value as plain int (e.g. "66")
echo "66"
}
function percentBar () {
local res= i=1
local percent=$( getPercent )
if [ -n "$( isMuted )" ]; then
res="<fc=$MUTED>"
else
res="<fc=$NORMAL>"
fi
while [ $i -lt $percent ]; do
res+='#'
i=$((i+1))
done
res+="</fc><fc=$FGCOLOR>"
while [ $i -lt 100 ]; do
res+='-'
i=$((i+1))
done
echo "$res</fc>"
}
echo "$( percentBar )" > "$STATUSPIPE"
|