WM-independent way to focus/raise URGENT window

focusgnomemetacitywindow-managerx11

I would like to have a keyboard shortcut to "go to" (focus + raise) window with URGENT flag set which looks like URGENT: it appears on the taskbar (Gnome + Metacity) even if it is on desktop other than current and starts to blink (thanks to @slm for pointing it out).

This window might be on other virtual desktop than current.

In this particular case it is Skype windows which set urgency flag, and so they appear in alt-tab popup (metacity WM) but I can't switch to this window if it is not on current virtual desktop.

I was looking into xdotool and wmctrl command with no luck.

Any ideas or clues?


Update: It appears, that I'm talking about _NET_WM_STATE = _NET_WM_STATE_DEMANDS_ATTENTION

Best Answer

I think I have found some working solution here.

Bash scripts provided there are what I was looking for and they apparently make use of wmctrl!

For quick access/archiving purposes I copy-n-paste both scripts here:

Jump to the window demanding attention:

#!/bin/bash
activeWinIdLine=`xprop -root | grep _NET_ACTIVE_WINDOW\(WINDOW\) `
activeWinId="${activeWinIdLine:40}"
echo $activeWinId > ~/activeWinId
for id in `wmctrl -l | cut -d " " -f 1`; do
    xprop -id $id | grep "_NET_WM_STATE_DEMANDS_ATTENTION" 2>&1 > /dev/null
    if [ "$?" = "0" ]; then
        wmctrl -i -a $id
        exit 0
    fi
done
exit 1

Jumps back to the window you were busy with:

#!/bin/bash
if [ -f ~/activeWinId ]; then
    origWinId=`cat ~/activeWinId`
    wmctrl -i -a $origWinId
fi

Thanks for discussion, especially @slm for directing me on the right lead.

Related Question