summaryrefslogtreecommitdiffstats
path: root/awesome_bar.sh
blob: 58c12e44f077b1726a2c7edb64d1b3cdbb36293b (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
#!/bin/zsh

SCREEN=0

func_power() {
	if [ -e /proc/acpi/battery/BAT0/info ]; then
		CAP=$(grep full /proc/acpi/battery/BAT0/info | awk '{print $4}')
		REM=$(grep remaining /proc/acpi/battery/BAT0/state | awk '{print $3}')
		STATE=$(($REM * 100 / $CAP))"%"

		echo $STATE
	else
		echo "No Battery"
	fi
}

func_mem() {
        TOT=$(free -m | grep Mem | awk '{print $2}')
        USE=$(free -m | grep buffers/cache | awk '{print $3}')
        MEM=$(($USE * 100 / $TOT))
        echo $MEM
}

while true; do
		echo $SCREEN widget_tell topbar power text " `func_power` " | awesome-client
		echo $SCREEN widget_tell topbar wlan text " $(print ${${$(LC_ALL=C /sbin/ifconfig wlan0)[7]}:gs/addr://}) " | awesome-client
		echo $SCREEN widget_tell topbar clock text " `date +"%x %T"` " | awesome-client
		echo $SCREEN widget_tell topbar hostname text " `hostname` " | awesome-client

		sleep 1
done

# vim: set tw=0 ts=4: