sites

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

dwm-clientresizehints-6.5.diff (2520B)


      1 From b2de13e11e7b4d67b4982ef51befa87ed9202080 Mon Sep 17 00:00:00 2001
      2 From: Fred Frey <fred@fpf3.net>
      3 Date: Sun, 22 Sep 2024 16:09:53 -0400
      4 Subject: [PATCH] implement per-client resizehints
      5 
      6 ---
      7  config.def.h | 6 +++---
      8  dwm.c        | 7 +++++--
      9  2 files changed, 8 insertions(+), 5 deletions(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 9efa774..67e7a9c 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -26,9 +26,9 @@ static const Rule rules[] = {
     16  	 *	WM_CLASS(STRING) = instance, class
     17  	 *	WM_NAME(STRING) = title
     18  	 */
     19 -	/* class      instance    title       tags mask     isfloating   monitor */
     20 -	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     21 -	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
     22 +	/* class      instance    title       tags mask     isfloating   monitor    resizehints */
     23 +	{ "Gimp",     NULL,       NULL,       0,            1,           -1,        1},
     24 +	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1,        1},
     25  };
     26  
     27  /* layout(s) */
     28 diff --git a/dwm.c b/dwm.c
     29 index 67c6b2b..f179b4c 100644
     30 --- a/dwm.c
     31 +++ b/dwm.c
     32 @@ -92,7 +92,7 @@ struct Client {
     33  	int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
     34  	int bw, oldbw;
     35  	unsigned int tags;
     36 -	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
     37 +	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, resizehints;
     38  	Client *next;
     39  	Client *snext;
     40  	Monitor *mon;
     41 @@ -139,6 +139,7 @@ typedef struct {
     42  	unsigned int tags;
     43  	int isfloating;
     44  	int monitor;
     45 +	int resizehints;
     46  } Rule;
     47  
     48  /* function declarations */
     49 @@ -299,6 +300,7 @@ applyrules(Client *c)
     50  		{
     51  			c->isfloating = r->isfloating;
     52  			c->tags |= r->tags;
     53 +			c->resizehints = r->resizehints;
     54  			for (m = mons; m && m->num != r->monitor; m = m->next);
     55  			if (m)
     56  				c->mon = m;
     57 @@ -343,7 +345,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
     58  		*h = bh;
     59  	if (*w < bh)
     60  		*w = bh;
     61 -	if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
     62 +	if (c->resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
     63  		if (!c->hintsvalid)
     64  			updatesizehints(c);
     65  		/* see last two sentences in ICCCM 4.1.2.3 */
     66 @@ -1043,6 +1045,7 @@ manage(Window w, XWindowAttributes *wa)
     67  	c->w = c->oldw = wa->width;
     68  	c->h = c->oldh = wa->height;
     69  	c->oldbw = wa->border_width;
     70 +	c->resizehints = resizehints;
     71  
     72  	updatetitle(c);
     73  	if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
     74 -- 
     75 2.46.0
     76