Marcin Cieslak wrote:
Probably this behaviour could/should be combined with your "nofocus" feature, i.e. locked windows should never get focus *at first*.

And another version - allow the "locked" window to be normally focused with mouse or keyboard, but do not focus it as the *first* client in
the view.

--Marcin
--- dwm.c.orig  2008-09-09 21:46:17.000000000 +0200
+++ dwm.c       2008-12-05 07:36:09.357994914 +0100
@@ -88,7 +88,7 @@
        int basew, baseh, incw, inch, maxw, maxh, minw, minh;
        int bw, oldbw;
        unsigned int tags;
-       Bool isfixed, isfloating, isurgent;
+       Bool isfixed, isfloating, isurgent, islocked;
        Client *next;
        Client *snext;
        Window win;
@@ -127,6 +127,7 @@
        const char *title;
        unsigned int tags;
        Bool isfloating;
+       Bool islocked;
 } Rule;
 
 /* function declarations */
@@ -259,6 +260,7 @@
                        && (!r->instance || (ch.res_name && strstr(ch.res_name, 
r->instance)))) {
                                c->isfloating = r->isfloating;
                                c->tags |= r->tags & TAGMASK;
+                               c->islocked = r->islocked;
                        }
                }
                if(ch.res_class)
@@ -497,9 +499,11 @@
        Client *c;
 
        for(c = clients; c; c = c->next) {
-               occ |= c->tags;
-               if(c->isurgent)
-                       urg |= c->tags;
+               if (!c->islocked) {
+                       occ |= c->tags;
+                       if(c->isurgent)
+                               urg |= c->tags;
+               }
        }
 
        dc.x = 0;
@@ -610,7 +614,7 @@
 void
 focus(Client *c) {
        if(!c || !ISVISIBLE(c))
-               for(c = stack; c && !ISVISIBLE(c); c = c->snext);
+               for(c = stack; c && (!ISVISIBLE(c) || c->islocked); c = 
c->snext);
        if(sel && sel != c) {
                grabbuttons(sel, False);
                XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@@ -1405,8 +1409,10 @@
 void
 tag(const Arg *arg) {
        if(sel && arg->ui & TAGMASK) {
-               sel->tags = arg->ui & TAGMASK;
-               arrange();
+               if (!sel->islocked) {
+                       sel->tags = arg->ui & TAGMASK;
+                       arrange();
+               }
        }
 }
 
@@ -1467,6 +1473,9 @@
 togglefloating(const Arg *arg) {
        if(!sel)
                return;
+       if (sel->islocked)
+               return;
+
        sel->isfloating = !sel->isfloating || sel->isfixed;
        if(sel->isfloating)
                resize(sel, sel->x, sel->y, sel->w, sel->h, True);
@@ -1479,6 +1488,8 @@
 
        if (!sel)
                return;
+       if (sel->islocked)
+               return;
        
        mask = sel->tags ^ (arg->ui & TAGMASK);
        if(sel && mask) {

Reply via email to