Few months ago, we discussed about a mail notification method for fetchmail/procmail and mutt combo. As you can see in that post, the script we wrote to handle notification was dependent on
ratpoison. Well it makes life bit tough for my non-ratpoison X sessions. I thought it would be a good idea to make the script window manager independent. Enter
The script uses
osd_cat. It comes in the XOSD package for most of the unices. It is similar to the
cat command for the console. It can read a file, string or the stdin and output the text onto X display. It has a bunch of config options which let you choose font, location etc. for the text. I’d recommend a RTM (man osd_cat).
Here is the code:
# Displays a string on the screen
# Last Modified: Mon 22 Jun 2009 02:59:55 AM IST
# let osd know, we have a X running. there will be problems if this script is
# called from different user. disable acl in X in that case(use xhost +).
# read from stdin if no args are present
if [ $# -ne 1 ]
echo $text | osd_cat --color=$color --delay=$delay --age=$age --font=$font --offset=$offset --shadow=\
$shadow --lines=$lines --align=$align --pos=$pos
This script can be used for any notification purpose. For using this with procmail, replace use the following construct in procmailrc:
| grep "From:" | /home/arun/bin/osd.sh
This will display alerts as “From: Foo Bar ” when a new mail is received.