#!/bin/sh typeset -A DISKS ### # Config ### DATE_FORMAT="%a %d %b, %Y" TIME_ZONES=("America/Toronto" "UTC") DISKS=(home /home root /) SEPERATOR=' ^fg(#86AA3F)^c(3)^fg() ' BAR_BG='#7DA926' BAR_FG='#B9D56E' BAR_HH=6 BAR_HW=40 BAR_VH=12 BAR_VW=3 BAR_ARGS="-bg $BAR_BG -fg $BAR_FG -w $BAR_HW -h $BAR_HH" ICON_DIR="$HOME/.dzen/icons/" NETWORK_INTERFACE=eth0 NET_DOWN_MAX=55 NET_UP_MAX=14 MAILDIR=~/.maildb/GMAIL/ GLOBALIVAL=1m DATEIVAL=60 TIMEIVAL=1 DISKIVAL=1 #CPUTEMPIVAL=5 #CPUIVAL=1 #NPIVAL=3 NETIVAL=1 ### # Functions ### _date() { date +${DATE_FORMAT} } _time() { local zone print_space=0 for zone in $TIME_ZONES; do [[ $print_space -eq 1 ]] && print -n " " print -n "${zone:t}: $(TZ=$zone date '+%H:%M')" print_space=1 done } # # Format: label1 mountpoint1 label2 mountpoint2 ... labelN mountpointN # Copied and modified from Rob get_disk_usage() { local rstr; local tstr; local i; local sep for i in ${(k)DISKS}; do tstr=$(print `df -h $DISKS[$i]|sed -ne 's/^.* \([0-9]*\)% .*/\1/p'` 100 | \ dzen2-gdbar -h $BAR_HH -w $BAR_HW -fg $BAR_FG -bg $BAR_BG -l "${i}" -nonl | \ sed 's/[0-9]\+%//g;s/ / /g') if [ ! -z "$rstr" ]; then sep=${SEPERATOR} fi rstr="${rstr}${sep}${tstr}" done print -n $rstr } # Requires mesure get_net_rates() { local up; local down up=`mesure -K -l -c 3 -t -o $NETWORK_INTERFACE` down=`mesure -K -l -c 3 -t -i $NETWORK_INTERFACE` echo "$down $up" } #cpu_temp() #{ # print -n ${(@)$(