Hi, 

I use dwm and trayer as notification area for applications like gajim &
etc. But it's ugly if panel can take focus with keyboard... Ugly as my
english. :)

This patch hacks dwm to omit trayer then windows switched with keyboard.

diff -r 759a5fbbd8b7 view.c
--- a/view.c	Fri Feb 16 16:51:27 2007 +0100
+++ b/view.c	Sat Feb 17 14:03:49 2007 +0500
@@ -63,7 +63,7 @@ dofloat(void) {
 		}
 	}
 	if(!sel || !isvisible(sel)) {
-		for(c = stack; c && !isvisible(c); c = c->snext);
+		for(c = stack; c && !focusable(c); c = c->snext);
 		focus(c);
 	}
 	restack();
@@ -115,21 +115,29 @@ dotile(void) {
 			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
 		}
 	if(!sel || !isvisible(sel)) {
-		for(c = stack; c && !isvisible(c); c = c->snext);
+		for(c = stack; c && !focusable(c); c = c->snext);
 		focus(c);
 	}
 	restack();
 }
 
+Bool 
+focusable(Client *c) {
+    return (c 
+	    && isvisible(c)
+	    && (strcmp("panel", c->name) != 0)
+	    );
+}
+
 void
 focusnext(Arg *arg) {
 	Client *c;
    
 	if(!sel)
 		return;
-	for(c = sel->next; c && !isvisible(c); c = c->next);
+	for(c = sel->next; c && !focusable(c); c = c->next);
 	if(!c)
-		for(c = clients; c && !isvisible(c); c = c->next);
+		for(c = clients; c && !focusable(c); c = c->next);
 	if(c) {
 		focus(c);
 		restack();
@@ -142,10 +150,10 @@ focusprev(Arg *arg) {
 
 	if(!sel)
 		return;
-	for(c = sel->prev; c && !isvisible(c); c = c->prev);
+	for(c = sel->prev; c && !focusable(c); c = c->prev);
 	if(!c) {
 		for(c = clients; c && c->next; c = c->next);
-		for(; c && !isvisible(c); c = c->prev);
+		for(; c && !focusable(c); c = c->prev);
 	}
 	if(c) {
 		focus(c);

Reply via email to