sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-floatrules-20201114-d08dd9c.diff (2125B)


      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  	Client *next;
     28  	Client *snext;
     29  	Monitor *mon;
     30 @@ -139,6 +140,8 @@
     31  	unsigned int tags;
     32  	int isfloating;
     33  	int monitor;
     34 +	int floatx, floaty, floatw, floath;
     35 +	int floatborderpx;
     36  } Rule;
     37  
     38  /* function declarations */
     39 @@ -299,6 +302,13 @@
     40  		{
     41  			c->isfloating = r->isfloating;
     42  			c->tags |= r->tags;
     43 +			c->floatborderpx = r->floatborderpx;
     44 +			if (r->isfloating) {
     45 +				c->x = c->mon->mx + r->floatx;
     46 +				c->y = r->floaty;
     47 +				c->w = r->floatw;
     48 +				c->h = r->floath;
     49 +			}
     50  			for (m = mons; m && m->num != r->monitor; m = m->next);
     51  			if (m)
     52  				c->mon = m;
     53 @@ -1281,7 +1291,10 @@
     54  	c->oldy = c->y; c->y = wc.y = y;
     55  	c->oldw = c->w; c->w = wc.width = w;
     56  	c->oldh = c->h; c->h = wc.height = h;
     57 -	wc.border_width = c->bw;
     58 +	if (c->isfloating && !c->isfullscreen)
     59 +		wc.border_width = c->floatborderpx;
     60 +	else
     61 +		wc.border_width = c->bw;
     62  	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
     63  	configure(c);
     64  	XSync(dpy, False);