2011
11.20

While most graphical programs programs will inform the user about events like new mail and incoming IM messages with nice popup messages using a notification mechanism like libnotify. Terminal programs usually only provide the possibility to beep once something happens. I think most people would call system bells annoying and just turn them off by running $ xset b off or disabling them somewhere in their desktop’s configuration.
Well, I really want to get notified when I’m getting pinged on IRC or when I receive new mail, so I was looking for a smarter (and especially less noisy) way to do this.

Some years ago I just disabled beeping for my zsh shell and Vim editor and enabled it for applications like Mutt and irssi, but in the meanwhile I found a nicer solution – turning a bell into an urgency hints. These are specified in the ICCCM and are used to tell the window-manager that a window needs the user’s attention.

For rxvt-unicode and XTerm, put these lines in your .Xresources or .Xdefaults file:

XTerm*bellIsUrgent: true
URxvt.urgentOnBell: true

As a side note, urxvt will set set the urgency hint even when the window is already focused. IMO this is a very annoying behaviour, so you might want this patch. Other terminals might also support this feature, but I haven’t tried another terminal for quite some time :)

Now it’s time to tweak your applications to be more noisy, let’s start with the terminal multiplexers.

GNU Screen, the good old terminal muxer
# use the audible bell instead of visual bell
vbell off

tmux (since version 1.5):
# Set action on window bell. any means a bell in any window linked to a
# session causes a bell in the current window of that session, none means
# all bells are ignored and current means only bell in windows other than
# the current window are ignored.
set-option -g bell-action any
# If on, ring the terminal bell when an activity, content or silence alert
# occurs.
set-option -g bell-on-alert on

These settings are really useful when you’re monitoring a logfile on a server for activity or waiting for your kernel compilation to finish.

Other applications:

Mutt: All mail clients suck. This one just sucks less :)
set beep=yes
set beep_new=yes

Irssi, an IRC client, supports several settings to configure beeps:
/set beep_when_window_active ON
/set beep_when_away ON
/set beep_msg_level MSGS NOTICES DCC DCCMSGS HILIGHT
/set bell_beeps ON

BTW, in combination with BitlBee, irssi is also an awesome instant-messaging client! ;)

Mcabber, a curses XMPP client, supports beeping when a new message arrives:
set beep_on_message = 1

Now, all these modifications doesn’t make sense as long as your window-manager doesn’t support urgency hints. Aweseome, a tiling window-manager and my weapon of choice, supports urgency hints out of the box. With the default settings, at least with the ones of the Debian package, you’ll recognize an urgent window by the changed color in your tasklist and taglist. To jump to the next urgent window you can use the ‘modkey-u’ shortcut. But there’s still some room for improvements. For example changing the window border and do what a modern notification system would do: showing a popup notification

-- put this in your "manage" signal handler
c:add_signal("property::urgent", function(c)
    if c.urgent then
        -- Change the border color of the urgent window.
        -- You'll need to define the color in your theme.lua, e.g.
        -- theme.border_urgent = "#FF3737CC"
        -- or you set the color directly to c.border_color 
        c.border_color = beautiful.border_urgent
 
        -- Show a popup notification with the window title
        naughty.notify({text="Urgent: " .. c.name})
    end
end)

An this is how it looks like:

Screenshot

Notification about an IRC query

I’m pretty sure other window-managers like xmonad support similar things…

And now’s the time to finally kill these annoying beeps by $ xset b off

:wq buz

Comments are closed.