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 ...

  • How do you know that the window hsa the URGENT flag?
    – slm
    Aug 7, 2013 at 15:32
  • Might be helpful: it.reddit.com/r/archlinux/comments/tbj6w/setting_wm_urgent_hint
    – slm
    Aug 7, 2013 at 15:36
  • The window manager is really in a better position to do this, why not do this in your window manager? Hmmm, ok, you're using Metacity; if you want fancy stuff, why stick with a minimalistic window manager? Aug 7, 2013 at 23:13
  • @slm: When new message arrives conversation window (which is placed on another desktop) appears on my taskbar with emphasized window name (bold) and blinking. If I click on the taskbar item using MOUSE cursors - WM switches desktop to the one, where conversation window is in, but I can't do it with keystroke, even if this window appears on so called "ALT-TAB" popup. This is probably WM (metacity) issue and is not the case of my question (for now).
    – roomcays
    Aug 8, 2013 at 11:21
  • UPDATE: OK, it appears, that this behaviour does not mean that URGENCY hint is set on the window. I'll update my question in a moment.
    – roomcays
    Aug 8, 2013 at 11:32

2 Answers 2


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:

activeWinIdLine=`xprop -root | grep _NET_ACTIVE_WINDOW\(WINDOW\) `
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
exit 1

Jumps back to the window you were busy with:

if [ -f ~/activeWinId ]; then
    origWinId=`cat ~/activeWinId`
    wmctrl -i -a $origWinId

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


There is a small working C project seturgent (thanks hiltjo). Usage:

seturgent <winid> [0|1] # 0: urgent off, 1: urgent on

Copying the source seturgent.c:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

static void die(const char *s) {
    fputs(s, stderr);

static void seturgency(Display *dpy, Window winid, Bool set) {
    XWMHints *hints = XGetWMHints(dpy, winid);
    if(!hints) {
        fputs("seturgent: unable to get window manager hints.\n", stderr);
        hints->flags |= XUrgencyHint;
        hints->flags &= ~XUrgencyHint;
    if(!XSetWMHints(dpy, winid, hints))
        fputs("seturgent: unable to set urgency hint.\n", stderr);

int main(int argc, char **argv) {
    Display *dpy;

    if(argc < 2 || !strcmp(argv[1], "-h")) /* help / usage */
        die("Usage: seturgent <winid> [0|1]\n");
    if(argc == 2 && !strcmp(argv[1], "-v")) /* version */
        die("seturgent-"VERSION" © 2010-2012 seturgent engineer, see " \
            "LICENSE file for details.\n");
    if(!(dpy = XOpenDisplay(NULL)))
        die("seturgent: unable to open display.\n");
    /* set the urgency hint (or not), if not specified its True. */
    seturgency(dpy, (Window)strtol(argv[1], NULL, 0),
               !((argc > 2) && !atol(argv[2])));
    XSync(dpy, False);

    return EXIT_SUCCESS;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .