diff options
author | Stefan Ritter <xeno@goliath.thehappy.de> | 2009-04-29 00:34:43 +0200 |
---|---|---|
committer | Stefan Ritter <xeno@goliath.thehappy.de> | 2009-04-29 00:34:43 +0200 |
commit | 5fccf763cd104357d2119b4b7066bca09fcfe154 (patch) | |
tree | dfa3f6e32d291ae5f492e9407a93a033f83b4b43 /awesome_bar.sh |
Re-release
Diffstat (limited to 'awesome_bar.sh')
-rwxr-xr-x | awesome_bar.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/awesome_bar.sh b/awesome_bar.sh new file mode 100755 index 0000000..e99d121 --- /dev/null +++ b/awesome_bar.sh @@ -0,0 +1,45 @@ +#!/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}') + CHARGING=$(grep "charging state" /proc/acpi/battery/BAT0/state | awk '{print $3}') + STATE=$(($REM * 100 / $CAP))"%" + + if [ "$CHARGING" = "charged" ]; then + echo $SCREEN widget_tell topbar power_logo image /home/xeno/etc/icons/iconpack03/actions/go-next.png | awesome-client + elif [ "$CHARGING" = "discharging" ]; then + echo $SCREEN widget_tell topbar power_logo image /home/xeno/etc/icons/iconpack03/actions/go-down.png | awesome-client + elif [ "$CHARGING" = "charging" ]; then + echo $SCREEN widget_tell topbar power_logo image /home/xeno/etc/icons/iconpack03/actions/go-up.png | awesome-client + fi + + 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 mem data mem_state " `func_mem` " | awesome-client + echo $SCREEN widget_tell topbar hdd data hdd_root `df / | tail -n 1 | awk '{print $4+100-100}'` | awesome-client + echo $SCREEN widget_tell topbar hdd data hdd_home `df /home | tail -n 1 | awk '{print $4+100-100}'` | awesome-client + echo $SCREEN widget_tell topbar wlan text " `/sbin/ifconfig | grep -A 1 wlan0 | tail -n 1 | awk '{print $2}' | sed 's/Adresse://g'` " | 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: |