xeno/awesome_bar.sh
2009-05-26 13:41:58 +02:00

33 lines
912 B
Bash
Executable file

#!/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: