blob: ba6dfa911587ce5b37f0345bdc0bf2ef9b50e689 (
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
64
65
66
67
|
#!/bin/bash
# Color definitions.
export BLK="\e[30m"
export RED="\e[31m"
export GRN="\e[32m"
export YLW="\e[33m"
export BLU="\e[34m"
export PUR="\e[35m"
export CYN="\e[36m"
export RST="\e[0m"
vol(){
vol=$(pulsemixer --get-volume | awk '{print $1}')
mute=$(pulsemixer --get-mute)
if [ "$mute" == 1 ]; then
echo -e "<span color='gray'>muted</span>"
else
echo -e "<span color='gray'>vol</span> $vol%"
fi
}
bat() {
power=$(cat /sys/class/power_supply/BAT0/capacity)
status=$(cat /sys/class/power_supply/BAT0/status)
if [ "$status" == "Charging" ]; then
echo -e "<span color='gray'>+bat</span> $power%"
else
echo -e "<span color='gray'>bat</span> $power%"
fi
}
dte() {
dte=$(date +"%a, %b %d")
echo -e "<span color='gray'>date</span> $dte"
}
tie() {
tme=$(date +"%I:%M %p")
echo -e "<span color='gray'>time</span> $tme"
}
prepend_zero () {
seq -f "%02g" $1 $1
}
cmus () {
artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-))
if [[ $artist = *[!\ ]* ]]; then
song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-))
position=$(cmus-remote -C status | grep position | cut -c 10-)
minutes1=$(prepend_zero $(($position / 60)))
seconds1=$(prepend_zero $(($position % 60)))
duration=$(cmus-remote -C status | grep duration | cut -c 10-)
minutes2=$(prepend_zero $(($duration / 60)))
seconds2=$(prepend_zero $(($duration % 60)))
# echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]"
echo -e "<span color='#a1efd3'>$song [$minutes1:$seconds1/$minutes2:$seconds2]</span>"
else
echo
fi
}
while :; do
echo " $(cmus) $(vol) $(bat) $(tie) $(dte) "
sleep 2
done
|