sites

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

dwm-tagfun-6.4.diff (1998B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 061ad66..8edac81 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -59,6 +59,14 @@ static const Layout layouts[] = {
      6  static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
      7  static const char *termcmd[]  = { "st", NULL };
      8  
      9 +static struct {
     10 +	void (*func)(const Arg *arg);
     11 +	const Arg arg;
     12 +} tagfun_cmds[LENGTH(tags)] = {
     13 +	[0] = { killclient, {0} },
     14 +	[1] = { spawn, { .v = termcmd } },
     15 +};
     16 +
     17  static const Key keys[] = {
     18  	/* modifier                     key        function        argument */
     19  	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
     20 @@ -108,6 +116,7 @@ static const Button buttons[] = {
     21  	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
     22  	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
     23  	{ ClkTagBar,            0,              Button1,        view,           {0} },
     24 +	{ ClkTagBar,            0,              Button2,        tagfun,         {0} },
     25  	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
     26  	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
     27  	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
     28 diff --git a/dwm.c b/dwm.c
     29 index e5efb6a..79b76cb 100644
     30 --- a/dwm.c
     31 +++ b/dwm.c
     32 @@ -208,6 +208,7 @@ static void showhide(Client *c);
     33  static void sigchld(int unused);
     34  static void spawn(const Arg *arg);
     35  static void tag(const Arg *arg);
     36 +static void tagfun(const Arg *arg);
     37  static void tagmon(const Arg *arg);
     38  static void tile(Monitor *m);
     39  static void togglebar(const Arg *arg);
     40 @@ -1658,6 +1659,17 @@ tag(const Arg *arg)
     41  	}
     42  }
     43  
     44 +void
     45 +tagfun(const Arg *arg)
     46 +{
     47 +	unsigned int i = arg->ui & TAGMASK, j = 0;
     48 +	if (i) {
     49 +		while ( i >>= 1) j++;
     50 +		if (tagfun_cmds[j].func)
     51 +			tagfun_cmds[j].func(&tagfun_cmds[j].arg);
     52 +	}
     53 +}
     54 +
     55  void
     56  tagmon(const Arg *arg)
     57  {