#!/bin/sh # show email information in the status bar # Configuration delay=10 barname="8-mail" maildir="$HOME/.Maildir" wmiiscript=$barname . wmii.sh # Functions mailcount() { echo -n $(ls -l $@ | grep ^- | wc -l) } output() { echo -n Mail $(mailcount $maildir/new) $(mailcount $maildir/.Lists*/new) } pid=$$ ( # Create bar with content echo "$WMII_BARCOLORS" | wmiir create /rbar/$barname while output | wmiir write $barname; do sleep delay done kill $pid ) & child=$! trap 'kill $child' exit wi_events <<'!' Event RightBarClick # React to clicks on our bar if test "$2" = "$barname"; then case "$1" in 1) fetchmail &;; 3) wmiir setsid x-terminal-emulator -e tail -n 200 -f ~/.fetchmaillog &;; esac fi;; ! wi_eventloop