aewl

changeset 284:5f5c56e104de

changed replacetag into toggletag
author Anselm R.Garbe <arg@10ksloc.org>
date Mon, 14 Aug 2006 16:59:18 +0200
parents 134804791d73
children e864d658eb02
files config.arg.h config.default.h dwm.h tag.c
diffstat 4 files changed, 61 insertions(+), 54 deletions(-) [+]
line diff
     1.1 --- a/config.arg.h	Mon Aug 14 16:37:55 2006 +0200
     1.2 +++ b/config.arg.h	Mon Aug 14 16:59:18 2006 +0200
     1.3 @@ -33,17 +33,17 @@
     1.4  	{ MODKEY|ControlMask,		XK_1,		toggleview,	{ .i = 0 } }, \
     1.5  	{ MODKEY|ControlMask,		XK_2,		toggleview,	{ .i = 1 } }, \
     1.6  	{ MODKEY|ControlMask,		XK_3,		toggleview,	{ .i = 2 } }, \
     1.7 -	{ MODKEY|ShiftMask,		XK_1,		replacetag,	{ .i = 0 } }, \
     1.8 -	{ MODKEY|ShiftMask,		XK_2,		replacetag,	{ .i = 1 } }, \
     1.9 -	{ MODKEY|ShiftMask,		XK_3,		replacetag,	{ .i = 2 } }, \
    1.10 +	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
    1.11 +	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
    1.12 +	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 2 } }, \
    1.13  	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
    1.14  	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
    1.15  	{ MODKEY|ShiftMask,		XK_Return,	spawn, \
    1.16  		{ .cmd = "exec urxvt +sb -tr -bg black -fg '#eeeeee' -cr '#eeeeee' +sb " \
    1.17  			"-fn '-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*'" } }, \
    1.18 -	{ MODKEY|ControlMask|ShiftMask,	XK_1,		appendtag,	{ .i = 0 } }, \
    1.19 -	{ MODKEY|ControlMask|ShiftMask,	XK_2,		appendtag,	{ .i = 1 } }, \
    1.20 -	{ MODKEY|ControlMask|ShiftMask,	XK_3,		appendtag,	{ .i = 2 } }, \
    1.21 +	{ MODKEY|ControlMask|ShiftMask,	XK_1,		toggletag,	{ .i = 0 } }, \
    1.22 +	{ MODKEY|ControlMask|ShiftMask,	XK_2,		toggletag,	{ .i = 1 } }, \
    1.23 +	{ MODKEY|ControlMask|ShiftMask,	XK_3,		toggletag,	{ .i = 2 } }, \
    1.24  };
    1.25  
    1.26  #define RULES \
     2.1 --- a/config.default.h	Mon Aug 14 16:37:55 2006 +0200
     2.2 +++ b/config.default.h	Mon Aug 14 16:59:18 2006 +0200
     2.3 @@ -34,19 +34,19 @@
     2.4  	{ MODKEY|ControlMask,		XK_2,		toggleview,	{ .i = 2 } }, \
     2.5  	{ MODKEY|ControlMask,		XK_3,		toggleview,	{ .i = 3 } }, \
     2.6  	{ MODKEY|ControlMask,		XK_4,		toggleview,	{ .i = 4 } }, \
     2.7 -	{ MODKEY|ShiftMask,		XK_0,		replacetag,	{ .i = 0 } }, \
     2.8 -	{ MODKEY|ShiftMask,		XK_1,		replacetag,	{ .i = 1 } }, \
     2.9 -	{ MODKEY|ShiftMask,		XK_2,		replacetag,	{ .i = 2 } }, \
    2.10 -	{ MODKEY|ShiftMask,		XK_3,		replacetag,	{ .i = 3 } }, \
    2.11 -	{ MODKEY|ShiftMask,		XK_4,		replacetag,	{ .i = 4 } }, \
    2.12 +	{ MODKEY|ShiftMask,		XK_0,		tag,		{ .i = 0 } }, \
    2.13 +	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 1 } }, \
    2.14 +	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 2 } }, \
    2.15 +	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 3 } }, \
    2.16 +	{ MODKEY|ShiftMask,		XK_4,		tag,		{ .i = 4 } }, \
    2.17  	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
    2.18  	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
    2.19  	{ MODKEY|ShiftMask,		XK_Return,	spawn,		{ .cmd = "exec xterm" } }, \
    2.20 -	{ MODKEY|ControlMask|ShiftMask,	XK_0,		appendtag,	{ .i = 0 } }, \
    2.21 -	{ MODKEY|ControlMask|ShiftMask,	XK_1,		appendtag,	{ .i = 1 } }, \
    2.22 -	{ MODKEY|ControlMask|ShiftMask,	XK_2,		appendtag,	{ .i = 2 } }, \
    2.23 -	{ MODKEY|ControlMask|ShiftMask,	XK_3,		appendtag,	{ .i = 3 } }, \
    2.24 -	{ MODKEY|ControlMask|ShiftMask,	XK_4,		appendtag,	{ .i = 4 } }, \
    2.25 +	{ MODKEY|ControlMask|ShiftMask,	XK_0,		toggletag,	{ .i = 0 } }, \
    2.26 +	{ MODKEY|ControlMask|ShiftMask,	XK_1,		toggletag,	{ .i = 1 } }, \
    2.27 +	{ MODKEY|ControlMask|ShiftMask,	XK_2,		toggletag,	{ .i = 2 } }, \
    2.28 +	{ MODKEY|ControlMask|ShiftMask,	XK_3,		toggletag,	{ .i = 3 } }, \
    2.29 +	{ MODKEY|ControlMask|ShiftMask,	XK_4,		toggletag,	{ .i = 4 } }, \
    2.30  };
    2.31  
    2.32  #define RULES \
     3.1 --- a/dwm.h	Mon Aug 14 16:37:55 2006 +0200
     3.2 +++ b/dwm.h	Mon Aug 14 16:59:18 2006 +0200
     3.3 @@ -116,19 +116,19 @@
     3.4  extern int xerror(Display *dsply, XErrorEvent *ee);
     3.5  
     3.6  /* tag.c */
     3.7 -extern void appendtag(Arg *arg);
     3.8  extern void dofloat(Arg *arg);
     3.9  extern void dotile(Arg *arg);
    3.10  extern void initrregs();
    3.11  extern Bool isvisible(Client *c);
    3.12  extern Client *getnext(Client *c);
    3.13  extern Client *getprev(Client *c);
    3.14 -extern void replacetag(Arg *arg);
    3.15  extern void restack();
    3.16  extern void settags(Client *c);
    3.17 +extern void tag(Arg *arg);
    3.18  extern void togglemode(Arg *arg);
    3.19 +extern void toggletag(Arg *arg);
    3.20 +extern void toggleview(Arg *arg);
    3.21  extern void view(Arg *arg);
    3.22 -extern void toggleview(Arg *arg);
    3.23  
    3.24  /* util.c */
    3.25  extern void *emallocz(unsigned int size);
     4.1 --- a/tag.c	Mon Aug 14 16:37:55 2006 +0200
     4.2 +++ b/tag.c	Mon Aug 14 16:59:18 2006 +0200
     4.3 @@ -35,16 +35,6 @@
     4.4  /* extern */
     4.5  
     4.6  void
     4.7 -appendtag(Arg *arg)
     4.8 -{
     4.9 -	if(!sel)
    4.10 -		return;
    4.11 -
    4.12 -	sel->tags[arg->i] = True;
    4.13 -	settitle(sel);
    4.14 -}
    4.15 -
    4.16 -void
    4.17  dofloat(Arg *arg)
    4.18  {
    4.19  	Client *c;
    4.20 @@ -183,19 +173,6 @@
    4.21  }
    4.22  
    4.23  void
    4.24 -replacetag(Arg *arg)
    4.25 -{
    4.26 -	int i;
    4.27 -
    4.28 -	if(!sel)
    4.29 -		return;
    4.30 -
    4.31 -	for(i = 0; i < ntags; i++)
    4.32 -		sel->tags[i] = False;
    4.33 -	appendtag(arg);
    4.34 -}
    4.35 -
    4.36 -void
    4.37  restack()
    4.38  {
    4.39  	static unsigned int nwins = 0;
    4.40 @@ -281,6 +258,20 @@
    4.41  }
    4.42  
    4.43  void
    4.44 +tag(Arg *arg)
    4.45 +{
    4.46 +	unsigned int i;
    4.47 +
    4.48 +	if(!sel)
    4.49 +		return;
    4.50 +
    4.51 +	for(i = 0; i < ntags; i++)
    4.52 +		sel->tags[i] = False;
    4.53 +	sel->tags[arg->i] = True;
    4.54 +	settitle(sel);
    4.55 +}
    4.56 +
    4.57 +void
    4.58  togglemode(Arg *arg)
    4.59  {
    4.60  	arrange = arrange == dofloat ? dotile : dofloat;
    4.61 @@ -288,6 +279,34 @@
    4.62  }
    4.63  
    4.64  void
    4.65 +toggletag(Arg *arg)
    4.66 +{
    4.67 +	unsigned int i;
    4.68 +
    4.69 +	if(!sel)
    4.70 +		return;
    4.71 +
    4.72 +	sel->tags[arg->i] = !sel->tags[arg->i];
    4.73 +	for(i = 0; i < ntags && !sel->tags[i]; i++);
    4.74 +	if(i == ntags)
    4.75 +		sel->tags[arg->i] = True;
    4.76 +	settitle(sel);
    4.77 +}
    4.78 +
    4.79 +
    4.80 +void
    4.81 +toggleview(Arg *arg)
    4.82 +{
    4.83 +	unsigned int i;
    4.84 +
    4.85 +	seltag[arg->i] = !seltag[arg->i];
    4.86 +	for(i = 0; i < ntags && !seltag[i]; i++);
    4.87 +	if(i == ntags)
    4.88 +		seltag[arg->i] = True; /* cannot toggle last view */
    4.89 +	arrange(NULL);
    4.90 +}
    4.91 +
    4.92 +void
    4.93  view(Arg *arg)
    4.94  {
    4.95  	unsigned int i;
    4.96 @@ -297,15 +316,3 @@
    4.97  	seltag[arg->i] = True;
    4.98  	arrange(NULL);
    4.99  }
   4.100 -
   4.101 -void
   4.102 -toggleview(Arg *arg)
   4.103 -{
   4.104 -	unsigned int i;
   4.105 -
   4.106 -	seltag[arg->i] = !seltag[arg->i];
   4.107 -	for(i = 0; !seltag[i] && i < ntags; i++);
   4.108 -	if(i == ntags)
   4.109 -		seltag[arg->i] = True; /* cannot toggle last view */
   4.110 -	arrange(NULL);
   4.111 -}