diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/.gitignore | 2 | ||||
-rw-r--r-- | bin/clock.sh | 44 | ||||
-rw-r--r-- | bin/dzen2_pgrp.sh | 27 |
3 files changed, 60 insertions, 13 deletions
diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..8174972 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +xrandr-notify +xinerama-resolution diff --git a/bin/clock.sh b/bin/clock.sh index 5b54a6a..0a36087 100644 --- a/bin/clock.sh +++ b/bin/clock.sh @@ -9,16 +9,48 @@ do if [ $TODAY -ne $OLD_TODAY ] then - MONTH=`date +'%m' | sed "s/^0//"` - YEAR=`date +'%Y'` + MONTH=$(date +'%_m') + YEAR=$(date +'%Y') [ $MONTH -eq 12 ] && YEAR=$(($YEAR + 1)) OLD_TODAY=$TODAY echo "^cs()" - echo - cal -m | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" | sed -u -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(#ff0000)\2^fg()\3/" - echo " " - cal -m $((($MONTH % 12) +1)) $YEAR | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" + if hash gcal 2>/dev/null; then + echo + gcal --cc-holidays=DE_BE --starting-day=Mon "${MONTH}" | sed "\ + # highlight current day + s/<\(\( \|[0-9]\)[0-9]\)>/ ^fg(#ff0000)\1^fg() /; \ + + # hightlight holiday + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + + # remove leftover holiday marker + s/:\(\( \|[0-9]\)[0-9]\)/ \1/g; \ + + # remove empty lines + /^[ \t]*$/d" + + echo " " + gcal --cc-holidays=DE_BE --starting-day=Mon "$((($MONTH % 12) +1))" "$YEAR" | sed "\ + # highlight current day + s/<\(\( \|[0-9]\)[0-9]\)>/ ^fg(#ff0000)\1^fg() /; \ + + # hightlight holiday + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + + # remove leftover holiday marker + s/:\(\( \|[0-9]\)[0-9]\)/ \1/g; \ + + # remove empty lines + /^[ \t]*$/d" + else + echo + cal -m ${MONTH} | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" | sed -u -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(#ff0000)\2^fg()\3/" + echo " " + cal -m $((($MONTH % 12) +1)) $YEAR | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" + fi fi sleep 1 diff --git a/bin/dzen2_pgrp.sh b/bin/dzen2_pgrp.sh index 83f801e..0b9808c 100644 --- a/bin/dzen2_pgrp.sh +++ b/bin/dzen2_pgrp.sh @@ -1,25 +1,38 @@ #!/bin/sh DIR="${HOME}/.dzen2/" FONT="-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*" +SCREEN=1 -cat $* | dzen2 -xs 1 -x 0 -w 1223 -ta l -fn "${FONT}" -bg black -e 'button1=none' & -MAIN=$! +# get width of screen +OFFSET=$(${DIR}/bin/xinerama-resolution ${SCREEN} | cut -dx -f1) + +CLOCK_WIDTH=$(textwidth "$FONT" "$(date)") +OFFSET=$((OFFSET - $CLOCK_WIDTH - 20)) +sh "${DIR}/bin/clock.sh" | dzen2 -xs ${SCREEN} -x ${OFFSET} -w $(($CLOCK_WIDTH + 20)) -fn "${FONT}" -bg black -l 17 -p -sa c -e 'button1=exec:xscreensaver-command -lock;button3=exec:xcalendar;button2=exec:xscreensaver-command -prefs;onstart=collapse;entertitle=uncollapse,unhide;leavetitle=collapse' & -sh "${DIR}/bin/bat.sh" | dzen2 -xs 1 -x 1360 -w 120 -fn "${FONT}" -bg black -e 'button1=none' & +if [ -e "/proc/acpi/battery/BAT0" ]; then + # if battery is available, display battery widget + OFFSET=$((OFFSET - 120)) + sh "${DIR}/bin/bat.sh" | dzen2 -xs ${SCREEN} -x ${OFFSET} -w 120 -fn "${FONT}" -bg black -e 'button1=none' & +fi -sh "${DIR}/bin/clock.sh" | dzen2 -xs 1 -x 1480 -w 200 -fn "${FONT}" -bg black -l 17 -p -sa c -e 'button1=exec:xscreensaver-command -lock;button3=exec:xcalendar;button2=exec:xscreensaver-command -prefs;onstart=collapse;entertitle=uncollapse,unhide;leavetitle=collapse' & - +OFFSET=$((OFFSET - 120)) gcpubar -fg '#999' -bg '#444' -w 50 -h 7 -l "^i(${DIR}/icons/cpu.xbm) " | \ sed -u 's/#D56F6C/#ff0000/' | \ - dzen2 -xs 1 -x 1240 -w 120 -fn "${FONT}" -bg black -e 'button1=none' & + dzen2 -xs ${SCREEN} -x ${OFFSET} -w 120 -fn "${FONT}" -bg black -e 'button1=none' & +OFFSET=$((OFFSET - 17)) ${DIR}/bin/pulse-dbus-receive.py | \ - /home/alex/dev/dzen/dzen2 -xs 1 -x 1223 -tw 17 -w 100 -fn "${FONT}" -bg black -sa c -l 1 \ + /home/alex/dev/dzen/dzen2 -xs ${SCREEN} -x ${OFFSET} -tw 17 -w 100 -fn "${FONT}" -bg black -sa c -l 1 \ -e 'entertitle=uncollapse,unhide;leavetitle=collapse;button2=exec:pavucontrol\ ;button1=print:sset Master toggle;button3=print:sset Master 80%\ ;button4=print:sset Master 2%+;button5=print:sset Master 2%-' | \ amixer -sq & +# fill the rest of the screen with the information from xmonad +cat $* | dzen2 -xs ${SCREEN} -x 0 -w ${OFFSET} -ta l -fn "${FONT}" -bg black -e 'button1=none' & +MAIN=$! + # kill bars on new RandR config ( ${DIR}/bin/xrandr-notify && kill ${MAIN} ) & |