sites

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

dwm-switchtotag-6.2.diff (1956B)


      1 diff -up dwm-6.2-original/config.def.h dwm-6.2-modified/config.def.h
      2 --- dwm-6.2-original/config.def.h	2019-02-02 14:55:28.000000000 +0200
      3 +++ dwm-6.2-modified/config.def.h	2019-11-18 19:36:22.515566509 +0200
      4 @@ -26,9 +26,9 @@ static const Rule rules[] = {
      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     switchtotag    isfloating   monitor */
     12 +	{ "Gimp",     NULL,       NULL,       0,            0,             1,           -1 },
     13 +	{ "Firefox",  NULL,       NULL,       1 << 8,       0,             0,           -1 },
     14  };
     15  
     16  /* layout(s) */
     17 diff -up dwm-6.2-original/dwm.c dwm-6.2-modified/dwm.c
     18 --- dwm-6.2-original/dwm.c	2019-02-02 14:55:28.000000000 +0200
     19 +++ dwm-6.2-modified/dwm.c	2019-11-18 19:37:18.792187705 +0200
     20 @@ -92,6 +92,7 @@ struct Client {
     21  	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
     22  	int bw, oldbw;
     23  	unsigned int tags;
     24 +	unsigned int switchtotag;
     25  	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
     26  	Client *next;
     27  	Client *snext;
     28 @@ -137,6 +138,7 @@ typedef struct {
     29  	const char *instance;
     30  	const char *title;
     31  	unsigned int tags;
     32 +	unsigned int switchtotag;
     33  	int isfloating;
     34  	int monitor;
     35  } Rule;
     36 @@ -302,6 +304,11 @@ applyrules(Client *c)
     37  			for (m = mons; m && m->num != r->monitor; m = m->next);
     38  			if (m)
     39  				c->mon = m;
     40 +			if (r->switchtotag) {
     41 +				Arg a = { .ui = r->tags };
     42 +				c->switchtotag = selmon->tagset[selmon->seltags];
     43 +				view(&a);
     44 +			}
     45  		}
     46  	}
     47  	if (ch.res_class)
     48 @@ -1782,6 +1789,10 @@ unmanage(Client *c, int destroyed)
     49  	focus(NULL);
     50  	updateclientlist();
     51  	arrange(m);
     52 +	if (c->switchtotag) {
     53 +		Arg a = { .ui = c->switchtotag };
     54 +		view(&a);
     55 +	}
     56  }
     57  
     58  void