dwm-floatrules-20201119-d08dd9c.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dwm-floatrules-20201119-d08dd9c.diff (2224B)
       ---
            1 diff -u dwm/config.def.h dwmnew/config.def.h
            2 --- dwm/config.def.h        2020-03-01 19:10:06.676821764 +1300
            3 +++ dwmnew/config.def.h        2020-03-01 19:29:26.276901430 +1300
            4 @@ -26,9 +26,9 @@
            5           *        WM_CLASS(STRING) = instance, class
            6           *        WM_NAME(STRING) = title
            7           */
            8 -        /* class      instance    title       tags mask     isfloating   monitor */
            9 -        { "Gimp",     NULL,       NULL,       0,            1,           -1 },
           10 -        { "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
           11 +        /* class      instance    title       tags mask     isfloating   monitor    float x,y,w,h         floatborderpx*/
           12 +        { "Gimp",     NULL,       NULL,       0,            1,           -1,        50,50,500,500,        5 },
           13 +        { "Firefox",  NULL,       NULL,       1 << 8,       0,           -1,        50,50,500,500,        5 },
           14  };
           15  
           16  /* layout(s) */
           17 Only in dwmnew: config.h
           18 Only in dwmnew: drw.o
           19 diff -u dwm/dwm.c dwmnew/dwm.c
           20 --- dwm/dwm.c        2020-03-01 19:10:06.680155097 +1300
           21 +++ dwmnew/dwm.c        2020-03-01 19:28:26.793564016 +1300
           22 @@ -93,6 +93,7 @@
           23          int bw, oldbw;
           24          unsigned int tags;
           25          int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
           26 +        int floatborderpx;
           27 +        int hasfloatbw;
           28          Client *next;
           29          Client *snext;
           30          Monitor *mon;
           31 @@ -139,6 +140,8 @@
           32          unsigned int tags;
           33          int isfloating;
           34          int monitor;
           35 +        int floatx, floaty, floatw, floath;
           36 +        int floatborderpx;
           37  } Rule;
           38  
           39  /* function declarations */
           40 @@ -299,6 +302,13 @@
           41                  {
           42                          c->isfloating = r->isfloating;
           43                          c->tags |= r->tags;
           44 +                        if (c->floatborderpx >= 0) {
           45 +                                c->floatborderpx = r->floatborderpx;
           46 +                                c->hasfloatbw = 1;
           47 +                        }
           48 +                        if (r->isfloating) {
           49 +                                c->x = c->mon->mx + r->floatx;
           50 +                                c->y = r->floaty;
           51 +                                c->w = r->floatw;
           52 +                                c->h = r->floath;
           53 +                        }
           54                          for (m = mons; m && m->num != r->monitor; m = m->next);
           55                          if (m)
           56                                  c->mon = m;
           57 @@ -1281,7 +1291,10 @@
           58          c->oldy = c->y; c->y = wc.y = y;
           59          c->oldw = c->w; c->w = wc.width = w;
           60          c->oldh = c->h; c->h = wc.height = h;
           61 -        wc.border_width = c->bw;
           62 +        if (c->isfloating && c->hasfloatbw && !c->isfullscreen)
           63 +                wc.border_width = c->floatborderpx;
           64 +        else
           65 +                wc.border_width = c->bw;
           66          XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
           67          configure(c);
           68          XSync(dpy, False);