Miscellaneous ephemera…

Setting Urgent Hints in dwm


After nearly 12 months of running a pretty stable dwm, with a consistent patchset (cycle, push, and init pertag1) I finally added another one: statuscolours2

I have been experimenting with WMFS, which is another very nice, minimal tiling window manager and was really enjoying the urgency hints in the status bar, so I decided to patch that functionality into dwm.

Most terminal applications will send a bell when your attention is required; in my case, I was looking for a way to trigger notifications for new mail in mutt or highlights in irssi. In mutt, it was just a case of setting a bell for when mail arrived:

set beep_new             # bell on new mail

And in irssi:

beep_msg_level = "NOTICE MSGS HILIGHT";

In tmux, to cover all your terminal bases, add:

set -g bell-action any # listen for activity on all windows

The next step is to pass those beeps to your terminal. The entry for Urxvt is one I picked up after a quick search turned up this post by rson which had the .Xdefaults line I was looking for:

URxvt*urgentOnBell: true

Now, whenever a bell is triggered in irssi or mutt, that is passed to the terminal as an urgent hint. The final step was patching statuscolors into dwm.c to change the tag colour when the hint was received.

You can see my patched dwm.c in my mercurial repo.

  1. These patches are from the extremely helpful Arch Forum thread: DWM Hackers Unite!
  2. I used a modified statuscolours patch from the suckless mailing list. It irons out the padding issues in the one on the wiki.