diff options
Diffstat (limited to '')
-rwxr-xr-x | dzen2.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/dzen2.sh b/dzen2.sh new file mode 100755 index 0000000..fa46549 --- /dev/null +++ b/dzen2.sh @@ -0,0 +1,41 @@ +#!/bin/zsh +# dzen2 script by Stefan Ritter <xeno@thehappy.de> + +COUNT=0 + +func_date() { + date +%x" "%T +} + +func_cputemp() { + if [ -e /proc/acpi/thermal_zone/THRM/temperature ]; then + echo $(cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2 "°"}') + fi +} + +func_battery() { + 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}') + echo $(($REM * 100 / $CAP))"%" + fi +} + +func_load() { + echo $(cat /proc/loadavg | awk '{print $1 " " $2 " " $3}') +} + +func_volume() { + amixer | grep -A 6 \'PCM\' | tail -n 1 | awk '{print $5}' | sed 's/\[//g' | sed 's/\]//g' +} + +func_wlanip() { + /sbin/ifconfig | grep -A 1 wlan0 | tail -n 1 | awk '{print $2}' | sed 's/Adresse://g' +} + +while true; do + print "^i(etc/pixelicons/spkr_01.xbm) $(func_volume) ^i(etc/pixelicons/info_01.xbm) $(func_load) ^i(etc/pixelicons/bat_full_02.xbm) $(func_battery) ^i(etc/pixelicons/temp.xbm) $(func_cputemp) ^ca(1,wicd-client -n)^i(etc/pixelicons/wifi_02.xbm)^ca() $(func_wlanip) ^i(etc/pixelicons/clock.xbm) $(func_date) ^fg(red)$(hostname) " + sleep 1 +done + +# vim: set tw=0: |