-
Notifications
You must be signed in to change notification settings - Fork 2
/
infoscript
executable file
·43 lines (34 loc) · 1022 Bytes
/
infoscript
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
#!/usr/bin/sh
# status bar for dwm
color_gray="" # gray on black
color_white="" # white on black
print_time() {
time="$(date "+%H:%M")"
echo -ne "${color_white}${time} "
}
print_battery() {
battery_status="$(acpi -b|tail -1)"
charging=""
if grep -q Charging <<<$battery_status; then charging="+"; fi
battery="$(echo ${battery_status}|sed -e "s/.*, \([0-9]*\)%.*/\1/g")"
echo -ne "${color_gray}Bat ${color_white}<b>${charging}${battery}</b>"
}
print_wifi() {
wifi="Off"
connection="$(iwgetid)"
if [ $? -eq 0 ]; then wifi="On"; fi
echo -ne "${color_gray}Net <b>${color_white}${wifi}</b>"
}
print_mem_used() {
mem_used="$(free -m | awk 'NR==2 {print $3}')"
echo -ne "${color_gray}Mem <b>${color_white}${mem_used}</b>"
}
print_temperature() {
temperature="$(acpi -t|awk 'END { print }'|sed -e "s/.*, \([0-9]*\).*/\1/g")"
echo -ne "${color_gray}Tem <b>${color_white}${temperature}</b>"
}
echo "$(print_temperature)\
$(print_mem_used)\
$(print_wifi)\
$(print_battery)\
$(print_time)"