From 3e394ad7b407f03ce447cc6c72d1279e114d9726 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Mon, 13 Dec 2021 17:12:49 -0500 Subject: dzen scripts are executable --- dot_dzen/battery.sh | 49 ------------ dot_dzen/dzen.sh | 156 ------------------------------------- dot_dzen/executable_battery.sh | 49 ++++++++++++ dot_dzen/executable_dzen.sh | 156 +++++++++++++++++++++++++++++++++++++ dot_dzen/executable_temperature.sh | 26 +++++++ dot_dzen/temperature.sh | 26 ------- 6 files changed, 231 insertions(+), 231 deletions(-) delete mode 100755 dot_dzen/battery.sh delete mode 100755 dot_dzen/dzen.sh create mode 100755 dot_dzen/executable_battery.sh create mode 100755 dot_dzen/executable_dzen.sh create mode 100755 dot_dzen/executable_temperature.sh delete mode 100755 dot_dzen/temperature.sh (limited to 'dot_dzen') diff --git a/dot_dzen/battery.sh b/dot_dzen/battery.sh deleted file mode 100755 index c50e53d..0000000 --- a/dot_dzen/battery.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/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='#000000' # 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='-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso8859-1' # font - -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=2 # time interval in seconds to hold display -TIME_ITER=5 # no of iterations in which time is displayed - -PREBAR="^i(${HOME}/.dzen/icons/power-bat.xbm) " # caption (also icons are possible) - -echo -n $PREBAR #uncomment for an icon - -PRESENT=`acpi -b`; -if [ "${PRESENT}" ]; then - STATUS=`echo ${PRESENT} | grep Charging`; - - RPERC=`echo ${PRESENT} | cut -d, -f2 | sed -e 's/[^0-9]//g'`; - - # draw the bar and pipe everything into dzen - if [ $RPERC -le $LOWBAT ]; then - GFG=$LOWCOL; - fi - if [ "${STATUS}" ]; then - GFG=$CHGCOL; - else - GFG='#33ccff'; - fi - echo $RPERC -else - echo '??' -fi diff --git a/dot_dzen/dzen.sh b/dot_dzen/dzen.sh deleted file mode 100755 index 0d2b8e4..0000000 --- a/dot_dzen/dzen.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/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 ${(@)$( +# 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='#000000' # 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='-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso8859-1' # font + +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=2 # time interval in seconds to hold display +TIME_ITER=5 # no of iterations in which time is displayed + +PREBAR="^i(${HOME}/.dzen/icons/power-bat.xbm) " # caption (also icons are possible) + +echo -n $PREBAR #uncomment for an icon + +PRESENT=`acpi -b`; +if [ "${PRESENT}" ]; then + STATUS=`echo ${PRESENT} | grep Charging`; + + RPERC=`echo ${PRESENT} | cut -d, -f2 | sed -e 's/[^0-9]//g'`; + + # draw the bar and pipe everything into dzen + if [ $RPERC -le $LOWBAT ]; then + GFG=$LOWCOL; + fi + if [ "${STATUS}" ]; then + GFG=$CHGCOL; + else + GFG='#33ccff'; + fi + echo $RPERC +else + echo '??' +fi diff --git a/dot_dzen/executable_dzen.sh b/dot_dzen/executable_dzen.sh new file mode 100755 index 0000000..0d2b8e4 --- /dev/null +++ b/dot_dzen/executable_dzen.sh @@ -0,0 +1,156 @@ +#!/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 ${(@)$( +# 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 diff --git a/dot_dzen/temperature.sh b/dot_dzen/temperature.sh deleted file mode 100755 index 4badbc5..0000000 --- a/dot_dzen/temperature.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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='#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