blob: d0cff02d4691296c7386acd36f84c340ceb997c2 (
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
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/bin/sh
# displays status of microphone, camera, wifi, free home disk space, and date/time
# uses icons found in nerd fonts here: https://github.com/ryanoasis/nerd-fonts.git
export DISPLAY=:0
unset status
##########################################################################
# MIC #
##########################################################################
# micsymbol_on=""
# micsymbol_off=""
# amixer get Capture | grep '\[off\]' && mic="$micsymbol_off" || mic="$micsymbol_on"
# status="$mic "
##########################################################################
# VOLUME #
##########################################################################
speakersymbol=""
if grep -q "yes" <<< $(pactl get-sink-mute $(pactl get-default-sink)) ; then
speakersymbol=""
vol=""
else
vol=$(echo $(pactl get-sink-volume $(pactl get-default-sink)) | cut -d"/" -f2 | xargs)
fi
status+="$speakersymbol $vol "
##########################################################################
# WIFI #
##########################################################################
wifisymbol_on=""
wifisymbol_off=""
# note: assumes we're using network-manager
ssid="$(nmcli -t -f active,ssid dev wifi | grep -E '^yes' | cut -d: -f2)"
wifi="$wifisymbol_off"
if [ "$ssid" != "" ]; then wifi="$wifisymbol_on $ssid"; fi
status+="$wifi "
##########################################################################
# BATTERY #
##########################################################################
# desktops don't typically have batteries. if no batteries are found, skip this section
if [[ -n $(find /sys/class/power_supply/ -name "BAT?") ]]; then
# however, laptops may have multiple batteries, so list them individually
for battery in /sys/class/power_supply/BAT?; do
batstat=$(sed "s/[Dd]ischarging//;s/[Nn]ot charging//;s/[Cc]harging//;s/[Uu]nknown//;s/[Ff]ull//" "$battery"/status)
battery_level=$(cat "$battery"/capacity 2>/dev/null)
status+="${batstat} ${battery_level}% "
done
fi
##########################################################################
# /HOME DISK #
##########################################################################
# disksymbol=""
# disk=$(df -hl | awk '{ if ($6 == "/home") print $4 " free" }')
# status+="$disksymbol $disk "
##########################################################################
# DATE / TIME #
##########################################################################
# Format Example: Thu Mar 25 03:37 PM CDT
calendarsymbol=""
status+="$calendarsymbol $(/bin/date +'%a %b %d %I:%M %p %Z')"
xsetroot -name "$status"
|