instant messaging

Geek I recently switched from Psi to mcabber. You know, the power of the shell, the cult of the console and stuff like that. The real reason is that mcabber interacts better with my favorite window manager, dwm, and has exactly the same functionalities I'm used to use.

After the switch, I needed to find a way to be notified of incoming messages; something simple, like a visual indicator or the like. mcabber can handle incoming events and execute an external script, so the only thing to do was finding a suitable tool for notification. Browsing around I found dzen, a general purpose notification utility. It is like a post-it you can put anywhere on the screen and it is very flexible.

So this is how I put things together:

$ vi .mcabber/jabber.org-rc

[...]
set events_command = /home/adotti/bin/notify.sh
[...]

and this is the notification script:

#! /bin/sh
#
# Simple event notifier for mcabber. Uses dzen2 to display messages.

event=$1
msg=$2

if [ $event = "MSG" ]; then
        case "$msg" in
        IN)
        ;;
        MUC)
        ;;
        OUT)
                exit 0
        ;;
        esac
        killall dzen2 > /dev/null 2>&1
        (echo "IM") | \
        dzen2 -p -x 1100 -w 30 -fn "-artwiz-snap-*-*-*-*-10-100-75-75-p-*-iso8859-1" &
fi

Note that I kept things really simple and there is a huge room for improvements. Anyway, every time an incoming message arrives, a little red square appears near the top right corner of the screen.

Filed under geek tools

glider [ minitrack ] ikiwiki Creative Commons VIM powered