summaryrefslogtreecommitdiffstats
path: root/.local/bin/statusbar
blob: 950a9e13848e51379b5698e1263168756817d77c (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
#!/bin/sh

print_wifi() {
	if=wlan0
	while IFS=':' read -r k v 
	do
		label=$(echo "$k"|trim)
		value=$(echo "$v"|trim)
		case $label in
		SSID) SSID=$value
			;;
		signal) SIGNAL=$value
			;;
		esac
	done <<-EOT
	$(iw "$if" link)
	EOT
	test "$SIGNAL" && echo "$SSID $SIGNAL"
}

while true
do
  xsetroot -name\
 "$(printf "%s %s %s %s%% %s"\
 "$(print_wifi)"\
 "$(ip -4 -j a show wlan0 | jq -r ".[0].addr_info[0].local")"\
 "$(($(grep MemAvailable /proc/meminfo | awk '{print $2}')/1024))M"\
 "$(cat /sys/class/power_supply/BAT0/capacity)"\
 "$(date "+W%V %d/%m %T%:::z")")"
sleep 1
done