hello list

I'm crafting a patch here since I use a lot of tag rules but I'm too lazy to
always switch tags. Maybe it's just another silly idea to automatically switch
tags when rules apply. Currently it works, but I plan on extending this feature
so that the new behavior can be switched on and off, and maybe it should even
be indicated on the bar.

cheers!
mar77i
--- dwm/dwm.c   2012-01-15 15:29:38.925066911 +0100
+++ dwm-active-focus/dwm.c      2012-01-15 19:08:57.311520877 +0100
@@ -1109,6 +1109,7 @@
 
 void
 manage(Window w, XWindowAttributes *wa) {
+       Arg arg;
        Client *c, *t = NULL;
        Window trans = None;
        XWindowChanges wc;
@@ -1159,11 +1160,20 @@
        attachstack(c);
        XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* 
some windows require this */
        setclientstate(c, NormalState);
-       if (c->mon == selmon)
-               unfocus(selmon->sel, False);
+       XMapWindow(dpy, c->win);
        c->mon->sel = c;
+       if (c->mon == selmon) {
+               unfocus(selmon->sel, False);
+               if((selmon->tagset[selmon->seltags] & c->tags) == 0)
+                       for(arg.ui = 0; arg.ui < LENGTH(tags); arg.ui++)
+                               if(c->tags & (1 << arg.ui)) {
+                                       // view the first tag where c is 
visible on
+                                       arg.ui = (1 << arg.ui);
+                                       view(&arg);
+                                       return;
+                               }
+       }
        arrange(c->mon);
-       XMapWindow(dpy, c->win);
        focus(NULL);
 }
 

Reply via email to