sites

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

dwm-toggleallmonspertag-6.4.diff (2205B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 061ad66..67afc6d 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -71,6 +71,7 @@ static const Key keys[] = {
      6  	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
      7  	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
      8  	{ MODKEY,                       XK_Return, zoom,           {0} },
      9 +	{ MODKEY|ShiftMask,             XK_Tab,    toggleall,      {0} },
     10  	{ MODKEY,                       XK_Tab,    view,           {0} },
     11  	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
     12  	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
     13 diff --git a/dwm.c b/dwm.c
     14 index e5efb6a..62f711b 100644
     15 --- a/dwm.c
     16 +++ b/dwm.c
     17 @@ -210,6 +210,7 @@ static void spawn(const Arg *arg);
     18  static void tag(const Arg *arg);
     19  static void tagmon(const Arg *arg);
     20  static void tile(Monitor *m);
     21 +static void toggleall(const Arg *arg);
     22  static void togglebar(const Arg *arg);
     23  static void togglefloating(const Arg *arg);
     24  static void toggletag(const Arg *arg);
     25 @@ -1694,6 +1695,49 @@ tile(Monitor *m)
     26  		}
     27  }
     28  
     29 +
     30 +void
     31 +toggleall(const Arg *arg)
     32 +{
     33 +	int i;
     34 +	unsigned int tmptag;
     35 +
     36 +	Monitor* m;
     37 +	for(m = mons; m; m = m->next){
     38 +
     39 +		if ((arg->ui & TAGMASK) == m->tagset[m->seltags])
     40 +			return;
     41 +		m->seltags ^= 1; /* toggle sel tagset */
     42 +		if (arg->ui & TAGMASK) {
     43 +			m->tagset[m->seltags] = arg->ui & TAGMASK;
     44 +			m->pertag->prevtag = m->pertag->curtag;
     45 +
     46 +			if (arg->ui == ~0)
     47 +				m->pertag->curtag = 0;
     48 +			else {
     49 +				for (i = 0; !(arg->ui & 1 << i); i++) ;
     50 +				m->pertag->curtag = i + 1;
     51 +			}
     52 +		} else {
     53 +			tmptag = m->pertag->prevtag;
     54 +			m->pertag->prevtag = m->pertag->curtag;
     55 +			m->pertag->curtag = tmptag;
     56 +		}
     57 +
     58 +		m->nmaster = m->pertag->nmasters[m->pertag->curtag];
     59 +		m->mfact = m->pertag->mfacts[m->pertag->curtag];
     60 +		m->sellt = m->pertag->sellts[m->pertag->curtag];
     61 +		m->lt[m->sellt] = m->pertag->ltidxs[m->pertag->curtag][m->sellt];
     62 +		m->lt[m->sellt^1] = m->pertag->ltidxs[m->pertag->curtag][m->sellt^1];
     63 +
     64 +		if (m->showbar != m->pertag->showbars[m->pertag->curtag])
     65 +			togglebar(NULL);
     66 +
     67 +		focus(NULL);
     68 +		arrange(m);
     69 +	}
     70 +}
     71 +
     72  void
     73  togglebar(const Arg *arg)
     74  {