Some window managers, including i3wm, the one I use at the moment, highlight windows and desktop tabs when the window or one of it’s children sets the X urgency hint. irssi, for example, supports that, allowing for nice and silent notifications when somebody querys or mentions you. However, even after hours of googeling, I couldn’t find any way to make Thunderbird set this flag when new mail arrives. This is why I came up with my own solution. I wrote a python script that finds the Thunderbird window and set’s the urgency hint using the python-xlib (which you would have to install yourself!) bindings. I then installed the Thunderbird extension Mailbox Alert, that allows you to specify scripts to be executed when new mail arrives – even on a per-folder basis. (The extension is pretty awesome, you should definitely check it out!) With that, everything works perfectly now.
The script setting the urgency hint is pretty basic. Here it is:
from Xlib import X, display, Xutil
def find_window(name, w):
for win in w.query_tree().children:
if win.get_wm_class() and win.get_wm_class()[1] == name:
return win
if len(win.query_tree().children) > 0:
a = find_window(name, win)
if a:
return a
def main(disp):
win = find_window("Thunderbird", disp.screen().root)
hints = win.get_wm_hints() or { 'flags': 0 }
hints['flags'] |= Xutil.UrgencyHint
win.set_wm_hints(hints)
disp.flush()
if __name__ == '__main__':
main(display.Display())
