On Wed, Jan 09, 2008 at 11:05:49PM +0100, Peter Vollmar wrote: > Following the discussion earlier in December I've found a good solution > with 'fetchmail -c' showing the number of new messages in the status bar. The > code copied from Martin Sander's comment is: > > fetchmail -c|sed 's/(//'|awk '{print $1-$3}' > 1 > > The problem is that fetchmail accesses the mail server as often as the > other services in the status bar are accessed - usually every few > seconds, which is unnecessarily often for imap! I've changed it to 60 > seconds, which is about the lowest reasonable for the 'date' and 'uptime'. Is > there anything we can do about this? > > Here below is the code of the loop in which dwm is started (gratefully copied > from the list) and .xinitrc : > > --- > in.sh: > > #!/bin/sh -e > > [ $# -eq 1 ]; FIFO="$1" > [ -e "$FIFO" ] || mkfifo "$FIFO" > [ -p "$FIFO" ] > exec >"$FIFO" 2>&1 > > while :; do > echo `uptime | sed 's/.*,//'` `date +'%a %d %b %R'` `fetchmail -c --sslproto > tls |sed 's/(//'|awk '{print $1-$3}'` > > sleep 60 > done > exit 1 # NOTREACHED > > -- > > .xinitrc: > > #!/bin/sh > xhkeys > feh --bg-scale /tmp/losung.pnm > > WM=dwm > fifo=~/.dwm/in > > ~/.dwm/in.sh $fifo & > while [ ! -p $fifo ]; do sleep .1; done > > $WM < $fifo & > wmpid=$! > wait $wmpid
Hi, I have a slightly different approach to get notified about emails (sorry, but I haven't read the former thread). On my machine fetchmail is started via crond and I have written a script which queries the maildirs and prints the new mails to stdout. This is then read by my .xinitrc . Just in case you are interested, I have attached the scripts. If someone knows some improvements, please don't hesitate to tell me. bye richi -- quoting guide: http://www.xs4all.nl/~hanb/documents/quotingguide.html
#!/bin/sh REFRESH_MAIL=60; COUNTER_MAIL=-1; function setWp() { display -window root ~/.wpChanger/montage.png } function assembleStatus() { # updating the counts ((COUNTER_MAIL >= REFRESH_MAIL ? COUNTER_MAIL = 0 : COUNTER_MAIL++)) if ((COUNTER_MAIL == 0)); then #MAIL=`mailcount.sh` MAIL=`checkMaildir.pl -l`; fi; LOAD=`cat /proc/loadavg`; DATE=`date "+%a %d.%b.%Y %X"`; echo "$MAIL || $LOAD || $DATE"; } case $1 in fvwm) exec /usr/bin/fvwm ;; wmii) setWp exec /usr/bin/wmii ;; dwm) setWp while sleep 1 ; do assembleStatus; done | dwm ;; openbox) exec /usr/bin/openbox ;; *) setWp while sleep 1 ; do assembleStatus; done | dwm ;; esac
checkMaildir.pl
Description: Perl program
pgp3kuEmaPH62.pgp
Description: PGP signature