From 1c019761dfaf6be82de9284fa5e2b9dbfbdec27d Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Sun, 14 Aug 2011 17:16:55 -0400 Subject: Initial import --- .dzen/battery.sh | 60 ++++++++++++++ .dzen/dzen.sh | 156 +++++++++++++++++++++++++++++++++++ .dzen/icons/arrow_down.xbm | 4 + .dzen/icons/arrow_up.xbm | 4 + .dzen/icons/bluetooth.xbm | 4 + .dzen/icons/corner.xbm | 5 ++ .dzen/icons/cpu.xbm | 6 ++ .dzen/icons/down.xbm | 6 ++ .dzen/icons/fwd.xbm | 4 + .dzen/icons/layout-full-black.xbm | 5 ++ .dzen/icons/layout-full.xbm | 8 ++ .dzen/icons/layout-gimp.xbm | 8 ++ .dzen/icons/layout-im-full.xbm | 8 ++ .dzen/icons/layout-im-mirror.xbm | 8 ++ .dzen/icons/layout-im-tall.xbm | 8 ++ .dzen/icons/layout-im.xbm | 8 ++ .dzen/icons/layout-mirror-black.xbm | 5 ++ .dzen/icons/layout-mirror-bottom.xbm | 8 ++ .dzen/icons/layout-mirror-top.xbm | 8 ++ .dzen/icons/layout-tall-black.xbm | 5 ++ .dzen/icons/layout-tall-left.xbm | 8 ++ .dzen/icons/layout-tall-right.xbm | 8 ++ .dzen/icons/layout-threecol.xbm | 8 ++ .dzen/icons/load.xbm | 6 ++ .dzen/icons/mail.xbm | 4 + .dzen/icons/mem.xbm | 6 ++ .dzen/icons/mpd.xbm | 6 ++ .dzen/icons/net-wifi.xbm | 6 ++ .dzen/icons/net-wifi3.xbm | 6 ++ .dzen/icons/net-wifi4.xbm | 6 ++ .dzen/icons/net-wifi5.xbm | 6 ++ .dzen/icons/net-wired.xbm | 6 ++ .dzen/icons/net-wired2.xbm | 6 ++ .dzen/icons/next.xbm | 4 + .dzen/icons/pause.xbm | 4 + .dzen/icons/phones.xbm | 4 + .dzen/icons/play.xbm | 4 + .dzen/icons/plus.xbm | 5 ++ .dzen/icons/power-ac.xbm | 6 ++ .dzen/icons/power-bat.xbm | 6 ++ .dzen/icons/power-bat2.xbm | 6 ++ .dzen/icons/prev.xbm | 4 + .dzen/icons/rwd.xbm | 4 + .dzen/icons/spkr_hi.xbm | 4 + .dzen/icons/spkr_mute.xbm | 4 + .dzen/icons/square.xbm | 5 ++ .dzen/icons/stop.xbm | 4 + .dzen/icons/temp.xbm | 6 ++ .dzen/icons/up.xbm | 6 ++ .dzen/icons/vol-hi.xbm | 6 ++ .dzen/icons/vol-mute.xbm | 6 ++ .dzen/icons/wifi_01.xbm | 4 + .dzen/icons/wifi_02.xbm | 4 + .dzen/temperature.sh | 26 ++++++ 54 files changed, 532 insertions(+) create mode 100755 .dzen/battery.sh create mode 100755 .dzen/dzen.sh create mode 100644 .dzen/icons/arrow_down.xbm create mode 100644 .dzen/icons/arrow_up.xbm create mode 100644 .dzen/icons/bluetooth.xbm create mode 100644 .dzen/icons/corner.xbm create mode 100644 .dzen/icons/cpu.xbm create mode 100644 .dzen/icons/down.xbm create mode 100644 .dzen/icons/fwd.xbm create mode 100644 .dzen/icons/layout-full-black.xbm create mode 100644 .dzen/icons/layout-full.xbm create mode 100644 .dzen/icons/layout-gimp.xbm create mode 100644 .dzen/icons/layout-im-full.xbm create mode 100644 .dzen/icons/layout-im-mirror.xbm create mode 100644 .dzen/icons/layout-im-tall.xbm create mode 100644 .dzen/icons/layout-im.xbm create mode 100644 .dzen/icons/layout-mirror-black.xbm create mode 100644 .dzen/icons/layout-mirror-bottom.xbm create mode 100644 .dzen/icons/layout-mirror-top.xbm create mode 100644 .dzen/icons/layout-tall-black.xbm create mode 100644 .dzen/icons/layout-tall-left.xbm create mode 100644 .dzen/icons/layout-tall-right.xbm create mode 100644 .dzen/icons/layout-threecol.xbm create mode 100644 .dzen/icons/load.xbm create mode 100644 .dzen/icons/mail.xbm create mode 100644 .dzen/icons/mem.xbm create mode 100644 .dzen/icons/mpd.xbm create mode 100644 .dzen/icons/net-wifi.xbm create mode 100644 .dzen/icons/net-wifi3.xbm create mode 100644 .dzen/icons/net-wifi4.xbm create mode 100644 .dzen/icons/net-wifi5.xbm create mode 100644 .dzen/icons/net-wired.xbm create mode 100644 .dzen/icons/net-wired2.xbm create mode 100644 .dzen/icons/next.xbm create mode 100644 .dzen/icons/pause.xbm create mode 100644 .dzen/icons/phones.xbm create mode 100644 .dzen/icons/play.xbm create mode 100644 .dzen/icons/plus.xbm create mode 100644 .dzen/icons/power-ac.xbm create mode 100644 .dzen/icons/power-bat.xbm create mode 100644 .dzen/icons/power-bat2.xbm create mode 100644 .dzen/icons/prev.xbm create mode 100644 .dzen/icons/rwd.xbm create mode 100644 .dzen/icons/spkr_hi.xbm create mode 100644 .dzen/icons/spkr_mute.xbm create mode 100644 .dzen/icons/square.xbm create mode 100644 .dzen/icons/stop.xbm create mode 100644 .dzen/icons/temp.xbm create mode 100644 .dzen/icons/up.xbm create mode 100644 .dzen/icons/vol-hi.xbm create mode 100644 .dzen/icons/vol-mute.xbm create mode 100644 .dzen/icons/wifi_01.xbm create mode 100644 .dzen/icons/wifi_02.xbm create mode 100755 .dzen/temperature.sh (limited to '.dzen') diff --git a/.dzen/battery.sh b/.dzen/battery.sh new file mode 100755 index 0000000..9e67834 --- /dev/null +++ b/.dzen/battery.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# original script by lyon8 +# modifications from original by +# show your laptop battery state in dzen +# Taken from http://www.webframp.com/2008/08/17/switchdzen/ and modified by Ryan +# Kavanagh to add support for a missing battery and use +# /sys instead of /proc/acpi/battery + +BG='#171717' # dzen backgrounad +FG='#008dd5' # dzen foreground +W=114 # width of the dzen bar +GW=50 # width of the gauge +GFG='#33ccff' # color of the gauge +GH=7 # height of the gauge +GBG='#333' # color of gauge background +X=0 # x position +Y=0 # y position +FN='snap' # font + +STATEFILE='/sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT1/uevent' # battery's state file + +LOWBAT=10 # percentage of battery life marked as low +LOWCOL='#ff4747' # color when battery is low +CHGCOL='#60da11' # color when battery is charging +TIME_INT=30 # time intervall in seconds + +PREBAR='^i(/home/ryan/.dzen/icons/power-bat.xbm) ' # caption (also icons are possible) + +while true; do + # look up battery's data + PRESENT=`cat $STATEFILE|grep POWER_SUPPLY_PRESENT|cut -d '=' -f 2`; + if [ $PRESENT = '1' ]; then + BAT_FULL=`cat $STATEFILE|grep POWER_SUPPLY_CHARGE_FULL_DESIGN | cut -d '=' -f 2 `; + STATUS=`cat $STATEFILE|grep POWER_SUPPLY_STATUS |cut -d '=' -f 2`; + RCAP=`cat $STATEFILE|grep POWER_SUPPLY_CHARGE_NOW|cut -d '=' -f 2`; + + echo $BAT_FULL " " $STATUS " " $RCAP > /dev/stdout + + # calculate remaining power + RPERCT=`expr $RCAP \* 100`; + RPERC=`expr $RPERCT / $BAT_FULL`; + + # draw the bar and pipe everything into dzen + if [ $RPERC -le $LOWBAT ]; then + GFG=$LOWCOL; + fi + if [ $STATUS = 'Charging' ]; then + GFG=$CHGCOL; + else + GFG='#33ccff'; + fi + echo -n $PREBAR #uncomment for an icon + eval echo $RPERC | dzen2-gdbar -h $GH -w $GW -fg $GFG -bg $GBG + else + echo -n $PREBAR #uncomment for an icon + eval echo 'Missing' + fi + sleep $TIME_INT; +done | dzen2 -ta c -tw $W -y $Y -x $X -fg $FG -bg $BG #-fn $FN diff --git a/.dzen/dzen.sh b/.dzen/dzen.sh new file mode 100755 index 0000000..59c4700 --- /dev/null +++ b/.dzen/dzen.sh @@ -0,0 +1,156 @@ +#!/bin/zsh + +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 ${(@)$( +# modifications from original by +# show your laptop battery state in dzen +# Taken from http://www.webframp.com/2008/08/17/switchdzen/ and modified by Ryan +# Kavanagh to add support for a missing battery and use +# /sys instead of /proc/acpi/battery + +BG='#171717' # dzen backgrounad +FG='#11DD11' # dzen foreground +W=130 # width of the dzen bar +GW=50 # width of the gauge +GFG='#33ccff' # color of the gauge +GH=7 # height of the gauge +GBG='#333' # color of gauge background +X=922 # x position +Y=0 # y position +FN='snap' # font +TIME_INT=10 + +TEMPERATURE=`acpi -t` + +while true; do + echo $TEMPERATURE | sed -e 's/.*ok, //g' && sleep $TIME_INT +done | dzen2 -ta c -tw $W -y $Y -x $X -fg $FG -bg $BG #-fn $FN -- cgit v1.2.3