-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbar-helper.sh
executable file
·85 lines (75 loc) · 1.94 KB
/
bar-helper.sh
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
80
81
82
83
84
85
#!/bin/sh -e
disk () {
disk=$(df -hl --no-sync | awk '/home/{ print $4 }' | sed '1q')
[ -z "$disk" ] && disk=$(df -h | awk '/ \/$/{ print $4 }')
printf "^c#4CBF99^%s" "disk: $disk"
}
mic() {
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q yes
then
mic="off"
else
mic="on"
fi
printf "%s" "^c#E6BA7E^mic: $mic"
}
temp () {
device_temp=$(cat /sys/class/thermal/thermal_zone*/type | grep -n x86 |\
sed 's/:x86.*//g')
device_temp=$(( device_temp - 1))
rawtemp=$(cat /sys/class/thermal/thermal_zone"$device_temp"/temp)
printf "^c#86B300^temp: %s" "$((${rawtemp:-0} / 1000))°C"
}
network () {
wlan0=$(iwctl device list | grep wl | cut -f 3 -d ' ')
network=$(iwctl station "$wlan0" show | awk '/Connected network/{print $3}')
[ -z "$network" ] && network=$(wpa_cli status | grep -E '^ssid' | sed 's/ssid=//')
[ -z "$network" ] && network="" && exit 0
printf "^c#DFBFFF^%s" "wifi: $network"
exit
}
volume () {
if pactl get-sink-mute @DEFAULT_SINK@ | grep -qi yes
then
volume="muted"
else
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Eo "[0-9]+%" |\
head -n1)
fi
printf "^c#399EE6^%s" "vol: $volume"
}
battery () {
battery=$(acpi -b | cut -d ':' -f 2 | cut -d ',' -f 1,2 | sed 's/^[ \t]*//' | tr '[:upper:]' '[:lower:]' | sed 's/, /(/')
case "$battery" in
"No support"*)
return;;
esac
printf "^c#F2AE49^%s" "bat: $battery)"
}
mail () {
nmail=$(find "$MAILPATH"/*/Inbox/new -type f 2>/dev/null | sed '/^$/d' | wc -l)
case "$nmail" in
0)
nmail="" ;;
[0-9]*)
nmail="m:$nmail" ;;
*)
nmail="" ;;
esac
printf "%s" "$nmail"
}
music () {
cmus_status=$(cmus-remote -Q 2>&1)
music_status=""
printf "%s" "$cmus_status" | grep -q "not running" && exit
if printf "%s" "$cmus_status" | grep -q "status playing"; then
music_status="playing"; else
music_status="pause"
fi
printf "^c#FA8D3E^music: %s" "$music_status"
}
mem () {
mem=$(free -h | awk '/Mem:/{ printf $3 }')
printf "^c#F07171^%s" "mem: $mem"
}
$1