#!/bin/zsh # vim:ft=zsh ts=4 #---------------------------------------------------------------------- # BAR SETTINGS #---------------------------------------------------------------------- BARBG='gray40' # Background color for gdbar BARFG='#aecf96' # Foreground color for gdbar BARH=7 # Height of gdbar BARW=60 # Width of gdbar #---------------------------------------------------------------------- # MAIL SETTINGS #---------------------------------------------------------------------- #MAILDIR= # set this if your maildir is not ~/Mail #---------------------------------------------------------------------- # SOUND SETTINGS #---------------------------------------------------------------------- SDEVICE='PCM' # Master or PCM ? Choose your setting ;) #---------------------------------------------------------------------- # DATE SETTINGS #---------------------------------------------------------------------- MYDATE_FORMAT='%H:%M:%S - %a, %d.%m.%y ' # How do you want date displayed ? #---------------------------------------------------------------------- # BITMAP SETTINGS #---------------------------------------------------------------------- BPATH='/home/jan/.xmonad/dzen_bitmaps/' # Where are your dzen-bitmaps ? BCOLOR='#80AA83' # How do you want 'em ? ################################################################################################ ################################################################################################ mybat() { full=`grep full /proc/acpi/battery/BAT0/info | awk -F' ' '{print $4}'` state=`grep "charging state" /proc/acpi/battery/BAT0/state | awk -F' ' '{print $3}'` remaining=`grep remaining /proc/acpi/battery/BAT0/state | awk -F' ' '{print $3}'` percentage=$(($remaining*100/$full)) if [[ $state == "charged" ]] then print -n " ch'd ($percentage%)" elif [[ $percentage -gt 50 ]] then print -n "$(echo $percentage | gdbar -fg $BARFG -bg $BARBG -h $BARH -w $BARW)" elif [[ $percentage -gt 25 ]] then print -n "$(echo $percentage | gdbar -fg '#ffff00' -bg $BARBG -h $BARH -w $BARW)" # Battery half -> Bar yellow elif [[ $percentage -lt 26 ]] then print -n "$(echo $percentage | gdbar -fg '#ff0000' -bg $BARBG -h $BARH -w $BARW)" # Battery low -> Bar red fi } mydate() { # date +${MYDATE_FORMAT} fuzzydate } mymail() { local -A counts; local i for i in "${MAILDIR:-${HOME}/Mail}"/**/new/* { (( counts[${i:h:h:t}]++ )) } for i in ${(k)counts} { print -n $i: $counts[$i]' ' } } mywireless() { print `iwconfig wlan0 | grep ESSID | sed 's/.*ESSID:"\(.*\)" .*/\1/' | awk '{ if (length($0)<10) print; else print substr($0,0,6) ".." substr($0,length($0)-1) }'` : `iwconfig wlan0 | grep 'Link Quality' | sed 's/.*Link Quality[=:]\(.*\)[\/ ] S.*/\1/'` } myvol() { VOL=`amixer get $SDEVICE | grep "Front" | awk {'print $5'} | grep -m 1 % | sed -e 's/[][%]//g'` ismute=`amixer get $SDEVICE | grep "Front" | awk {'print $7'} | grep -m 1 "[on|off]" | sed -e 's/[][]//g'` if [[ $ismute == "off" ]]; then print -n "$(echo " MUTE")" else print -n "$(echo $VOL | gdbar -fg $BARFG -bg $BARBG -h $BARH -w $BARW)" fi } mycputemp() { print -n `cat /proc/acpi/thermal_zone/THM0/temperature | awk -F' ' '{print $2}'`" "`cat /proc/acpi/thermal_zone/THM1/temperature | awk -F' ' '{print $2}'` } # Main while true; do print -n "^fg($BCOLOR)^i($BPATH/wifi.xbm)^fg()$(mywireless) | ^fg($BCOLOR)^i($BPATH/battery.xbm)^fg()$(mybat) | $(mydate) \n" sleep 30 done