diff -r 41678fc29f2a config.def.h
--- a/config.def.h	Sun Oct 19 12:59:18 2008 +0100
+++ b/config.def.h	Sat Nov 29 21:22:43 2008 +0100
@@ -8,6 +8,7 @@
 static const char selbordercolor[]  = "#0066ff";
 static const char selbgcolor[]      = "#0066ff";
 static const char selfgcolor[]      = "#ffffff";
+static const char urgentbordercolor[]      = "#ff0000";
 static unsigned int borderpx        = 1;        /* border pixel of windows */
 static unsigned int snap            = 32;       /* snap pixel */
 static Bool showbar                 = True;     /* False means no bar */
diff -r 41678fc29f2a dwm.c
--- a/dwm.c	Sun Oct 19 12:59:18 2008 +0100
+++ b/dwm.c	Sat Nov 29 21:22:43 2008 +0100
@@ -138,7 +138,7 @@
 static void buttonpress(XEvent *e);
 static void checkotherwm(void);
 static void cleanup(void);
-static void clearurgent(void);
+static void clearurgent(Client *c);
 static void configure(Client *c);
 static void configurenotify(XEvent *e);
 static void configurerequest(XEvent *e);
@@ -213,6 +213,7 @@
 static unsigned int seltags = 0, sellt = 0;
 static int (*xerrorxlib)(Display *, XErrorEvent *);
 static unsigned int numlockmask = 0;
+static unsigned long urgentcolor;
 static void (*handler[LASTEvent]) (XEvent *) = {
 	[ButtonPress] = buttonpress,
 	[ConfigureRequest] = configurerequest,
@@ -365,20 +366,17 @@
 }
 
 void
-clearurgent(void) {
+clearurgent(Client *c) {
 	XWMHints *wmh;
-	Client *c;
 
-	for(c = clients; c; c = c->next)
-		if(ISVISIBLE(c) && c->isurgent) {
-			c->isurgent = False;
-			if (!(wmh = XGetWMHints(dpy, c->win)))
-				continue;
-
-			wmh->flags &= ~XUrgencyHint;
-			XSetWMHints(dpy, c->win, wmh);
-			XFree(wmh);
-		}
+	if(c && c->isurgent) {
+		c->isurgent = False;
+		if (!(wmh = XGetWMHints(dpy, c->win)))
+			return;
+		wmh->flags &= ~XUrgencyHint;
+		XSetWMHints(dpy, c->win, wmh);
+		XFree(wmh);
+	}
 }
 
 void
@@ -617,6 +615,7 @@
 		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
 	}
 	if(c) {
+		clearurgent(c);
 		detachstack(c);
 		attachstack(c);
 		grabbuttons(c, True);
@@ -1338,6 +1337,7 @@
 	dc.sel[ColBorder] = getcolor(selbordercolor);
 	dc.sel[ColBG] = getcolor(selbgcolor);
 	dc.sel[ColFG] = getcolor(selfgcolor);
+	urgentcolor = getcolor(urgentbordercolor);
 	dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
 	dc.gc = XCreateGC(dpy, root, 0, 0);
 	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
@@ -1506,7 +1506,6 @@
 
 	if(mask) {
 		tagset[seltags] = mask;
-		clearurgent();
 		arrange();
 	}
 }
@@ -1661,13 +1660,9 @@
 	XWMHints *wmh;
 
 	if((wmh = XGetWMHints(dpy, c->win))) {
-		if(ISVISIBLE(c) && wmh->flags & XUrgencyHint) {
-			wmh->flags &= ~XUrgencyHint;
-			XSetWMHints(dpy, c->win, wmh);
-		}
-		else
-			c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
-
+		c->isurgent = (c != sel && wmh->flags & XUrgencyHint) ? True : False;
+		if(c->isurgent)
+			XSetWindowBorder(dpy, c->win, urgentcolor);
 		XFree(wmh);
 	}
 }
@@ -1679,7 +1674,6 @@
 	seltags ^= 1; /* toggle sel tagset */
 	if(arg->ui & TAGMASK)
 		tagset[seltags] = arg->ui & TAGMASK;
-	clearurgent();
 	arrange();
 }
 
