Jan-Philipp Litza

Terminal bell after long running commands

Sometimes I wonder “Why on earth didn’t I think of this before?”. Today was such a day, when I thought: Why not get notified automatically when long running commands in a terminal finish? Actually, there’s a mechanism in the window manager for highlighting windows needing attention. Why shouldn’t a terminal prompt after a long running command be such a situation?

The solution actually was pretty simple. I found a ZSH sniplet that rings the bell after a long running command that I modified a bit to my liking, and all that was left was to configure my terminal emulator urxvt to make a ringing bell call for attention, using the following line in ~/.Xresources:

urxvt*urgentOnBell:     true

There you go, now when some build process finishes or aborts, the corresponding terminal window blinks in my taskbar. Yay! ☺

Update: Since I switched to Gnome 3 shortly after, I had to find a way to make the urgent bit visible there as well. Luckily, I found an ancient extension that does precisely that.