Re: [dwm] mail notification again

From: Peter Vollmar <linux_AT_vollmar.ch>
Date: Sat, 19 Jan 2008 21:51:17 +0100 (CET)

On 15 Jan Jukka Salmi wrote:

>I noticed that you're using the
> in.sh script I once posted to this list (IIRC). Have a [1]look at the
> version I'm currently using, maybe it fits you needs:

Thank you so much Jukka, your script works great. I've tried to simplify
it to fit my needs, now I have everything in one script. Apart from the
in.sh with FIFO solution, I have also managed to incorporate your script
in my .xinitrc in the usual dwm loop. (I didn't know how to get rid of
the [if $MCK...] clause though, since I don't need the "no" option here,
but anyhow, it's working...)

I have noticed that when running with the FIFO option, upon dwm shutdown
some running programs get killed before they can save their
configuration (resulting in repeated file corruption in some cases!).
This doesn't seem to happen with the direct loop, although dwm sometimes
takes about 5-10 seconds to close down all programs (or is it the X
server?).
Can you explain this behaviour?
By the way, is "dwm -q" the same as "killall dwm" (to use in a shutdown
script)?

Anyway, here's my most recent .xinitrc, running dwm without FIFO, and
showing uptime and date every 7 seconds and the number of mails calling
"fetchmail -c" every 280 seconds in the output bar.

--
xhkeys
feh --bg-scale /tmp/losung.pnm
while true; do
: ${DELAY:=40} \
  ${MCK:=yes} \
  ${MCK_INT:=7} # if $MCK != no, run mail check every $(( $MCK_INT * $DELAY )) seconds
main()
{
	local now loadavg
	local i=0 nmsgs=
	# loop forever
	while :; do
	now="$(date +'%a %d %b %R')"
	loadavg="$(uptime | sed 's/.*,//')"
	if [ $MCK != 'no' ]; then
		if [ $i -eq 0 ]; then
	
	nmsgs="$(fetchmail -c --sslproto tls | sed 's/(//' | awk '{print $1-$3}')"
		fi
		i=$(( ($i+1) % ${MCK_INT:?} ))
	fi
echo "$loadavg" "$now" "$nmsgs"
	sleep ${DELAY:?}
	done
}
main
sleep 1 
done | dwm
-- 
Mit freundlichen Grüssen
P. Vollmar
Dipl. Übersetzer HDS
VOLLMAR ÜBERSETZUNGS-SERVICE
CH-9248 BICHWIL, SWITZERLAND
Tel/Fax:   +41 071 952'77'45
Homepage: www.vollmar.ch
Aktuell:  www.vollmar.ch/download
Computer: www.vollmar.ch/linux
Received on Sat Jan 19 2008 - 21:51:50 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:16:20 UTC