-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdzenstatus
More file actions
executable file
·70 lines (61 loc) · 2.02 KB
/
dzenstatus
File metadata and controls
executable file
·70 lines (61 loc) · 2.02 KB
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
68
69
70
#!/bin/bash
# spectrwm statusbar script
SLEEP_SEC=5
COUNT=0
while :; do
tgl(){
tgl="$(date +"%a, %d %b")"
jam="$(date +"%H:%M")"
echo -e "$tgl $jam"
}
bat(){
perc="$(acpi -b | awk '{print +$4}')"
charge="$(acpi -b | grep "Charging")"
online="$(acpi -V | grep "on-line")"
full="$(acpi -b | grep 'Full')"
if [ -z "$charge" ] && [ -z "$perc" ]; then
echo -e "^fg(#AFAF00)·BAT·^fg() no-bat"
elif [ -z "$online" ] && [ "$perc" -le "25" ]; then
echo -e "^fg(#BA4834)·BAT·^fg() $perc% BATTERY LOW^fg();"
elif [ "$perc" -ge "85" ]; then
echo -e "^fg(#AFAF00)·BAT·^fg() $perc%"
else
echo -e "^fg(#AFAF00)·BAT·^fg() $perc%"
fi
}
vol(){
mute=`amixer get Master | grep off`
if [ -z $mute ]; then
vol=`amixer get Master | grep -m 1 -o '[0-9][0-9]*%'`
echo -e "\uE05D $vol"
else
echo -e "\x02\uE05F\x01"
fi
}
mem(){
#mem=`free -m | awk '/Mem:/ {printf("%d%", $3/$2*100)}'`
mem=`free -h | awk '/Mem:/ {printf("%s", $3)}'`
echo -e "^fg(#AFAF00)·RAM·^fg() $mem"
}
cpu(){
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
echo -e "^fg(#AFAF00)·CPU·^fg() $cpu%"
}
mpd(){
if mpc &> /dev/null && [[ $(mpc | wc -l) != 1 ]]; then
if [[ $(mpc | awk 'NR==2 {print $1}') == "[paused]" ]] ; then
echo -e "\x02\uE0FE\x01 $( mpc | head -1 )"
else
echo -e "\x02\uE0FD\x01 $( mpc | head -1 )"
fi
fi
}
echo -e " $(cpu) | $(mem) | $(bat) "
sleep $SLEEP_SEC; done | dzen2 -ta c \
-fn '-*-IBM Plex Mono-Medium-r-normal-*-12-*-*-*-n-*-*-*' \
-bg '#1D2021' -fg '#EAE5E5'