From c6884614e88d1f194f4572711b2493a6da6561c4 Mon Sep 17 00:00:00 2001 From: gotmor Date: Sun, 5 Aug 2007 12:45:39 +0000 Subject: small readibilĘ£ty fixes documentation typo fixes kittscanner.sh improved execution speed new noisyalert.sh gadget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://dzen.googlecode.com/svn/trunk@152 f2baff5b-bf2c-0410-a398-912abdc3d8b2 --- gadgets/README.kittscanner | 4 ++-- gadgets/kittscanner.sh | 9 +++++---- gadgets/noisyalert.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 gadgets/noisyalert.sh (limited to 'gadgets') diff --git a/gadgets/README.kittscanner b/gadgets/README.kittscanner index 37da5bc..a436d74 100644 --- a/gadgets/README.kittscanner +++ b/gadgets/README.kittscanner @@ -8,7 +8,7 @@ other than just displaying text ;). It implements sort of a KITT (Knight Rider, TV series) scanner in shell script. -There are some setting that you can tweak to your likings, see -"kitt-scanner.sh" for further details. +There are some settings that you can tweak to your likings, see +"kittscanner.sh" for further details. diff --git a/gadgets/kittscanner.sh b/gadgets/kittscanner.sh index 0a99e64..a222e72 100755 --- a/gadgets/kittscanner.sh +++ b/gadgets/kittscanner.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# (c) 2007 by Robert Manea +# (c) 2007 by Robert Manea # # KITT Scanner for dzen - a man, a car, a dzen # @@ -31,6 +31,7 @@ RECT="^r(${LED_WIDTH}x${LED_HEIGHT})" i=; j=1; SIGN='+' +# build a number list "1 2 ... $SCANNER_LEDS" nr_list_leds() { l=1 lnr=$1 @@ -42,9 +43,10 @@ nr_list_leds() { echo $NRLIST } +LED_LIST=`nr_list_leds $SCANNER_LEDS` while :; do - for i in `nr_list_leds $SCANNER_LEDS`; do + for i in $LED_LIST; do if [ "$i" -eq "$j" ]; then KBAR=${KBAR}"^p(${LED_SPACING})"${LFG}${RECT}${DFG} else @@ -58,8 +60,7 @@ while :; do if [ $SIGN = '+' ] && [ $j -ge $SCANNER_LEDS ]; then j=$SCANNER_LEDS SIGN='-' - fi - if [ $SIGN = '-' ] && [ $j -eq 1 ]; then + elif [ $SIGN = '-' ] && [ $j -eq 1 ]; then j=1 SIGN='+' fi diff --git a/gadgets/noisyalert.sh b/gadgets/noisyalert.sh new file mode 100644 index 0000000..75be808 --- /dev/null +++ b/gadgets/noisyalert.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# (c) 2007 by Robert Manea +# +# A noisy alert for dzen +# +# Syntax noisyalert.sh [Message] [TIMEOUT in seconds] | dzen2 + +ALERTMSG=${1:-"Alert"} +ALERTSEC=${2:-10} + +RECTW=10 +RECTH=10 + + +while [ $ALERTSEC -ne 0 ]; do + + if [ `expr $ALERTSEC % 2` -eq 0 ]; then + echo "^r(${RECTW}x${RECTH}) $ALERTMSG" + else + echo "^ro(${RECTW}x${RECTH}) $ALERTMSG" + fi + + ALERTSEC=`expr $ALERTSEC - 1` + sleep 1 +done + -- cgit v1.2.3-54-g00ecf