aewl

changeset 766:3f7c68a720b5

undone naming change: "group" is "tag" again (but without plural)
author meillo@marmaro.de
date Fri, 05 Dec 2008 19:43:56 +0100
parents f1d4bc4afcd9
children 706991d15451
files aewl.c config.h
diffstat 2 files changed, 45 insertions(+), 36 deletions(-) [+]
line diff
     1.1 --- a/aewl.c	Fri Dec 05 19:13:24 2008 +0100
     1.2 +++ b/aewl.c	Fri Dec 05 19:43:56 2008 +0100
     1.3 @@ -18,10 +18,7 @@
     1.4   * Each child of the root window is called a client, except windows which have
     1.5   * set the override_redirect flag.  Clients are organized in a global
     1.6   * doubly-linked client list, the focus history is remembered through a global
     1.7 - * stack list. Each client contains an array of Bools of the same size as the
     1.8 - * global tags array to indicate the tags of a client.  For each client dwm
     1.9 - * creates a small title window, which is resized whenever the (_NET_)WM_NAME
    1.10 - * properties are updated or the client is moved/resized.
    1.11 + * stack list. [...]
    1.12   *
    1.13   * Keys and tagging rules are organized as arrays and defined in the config.h
    1.14   * file. These arrays are kept static in event.o and tag.o respectively,
    1.15 @@ -30,8 +27,20 @@
    1.16   * domax() or dotile().
    1.17   *
    1.18   * To understand everything else, start reading main.c:main().
    1.19 + *
    1.20 + * -- and now about aewl --
    1.21 + *
    1.22 + * aewl is a stripped down dwm. It stated as a patchset, but finally forked off
    1.23 + * completely. The reason for this was the increasing gap between my wish to
    1.24 + * stay where dwm was, and dwm direction to go further. Further more did I
    1.25 + * always use only a small subset of dwm's features, so condencing dwm had been
    1.26 + * my wish for a long time.
    1.27 + *
    1.28 + * In aewl clients are either tagged or not (only one tag). Visible are either
    1.29 + * all tagged clients or all without the tag.
    1.30   */
    1.31  
    1.32 +
    1.33  #include "config.h"
    1.34  #include <errno.h>
    1.35  #include <locale.h>
    1.36 @@ -86,7 +95,7 @@
    1.37  	long flags;
    1.38  	unsigned int border;
    1.39  	Bool isfixed, isfloat, ismax;
    1.40 -	Bool group;
    1.41 +	Bool tag;
    1.42  	Client *next;
    1.43  	Client *prev;
    1.44  	Client *snext;
    1.45 @@ -95,7 +104,7 @@
    1.46  
    1.47  typedef struct {
    1.48  	const char *clpattern;
    1.49 -	int group;
    1.50 +	int tag;
    1.51  	Bool isfloat;
    1.52  } Rule;
    1.53  
    1.54 @@ -126,7 +135,7 @@
    1.55  void (*handler[LASTEvent])(XEvent *);	/* event handler */
    1.56  void (*arrange)(void);			/* arrange function, indicates mode  */
    1.57  Atom wmatom[WMLast], netatom[NetLast];
    1.58 -Bool running, selscreen, selgroup;
    1.59 +Bool running, selscreen, seltag;
    1.60  Client *clients, *sel, *stack;		/* global client list and stack */
    1.61  Cursor cursor[CurLast];
    1.62  DC dc;					/* global draw context */
    1.63 @@ -177,7 +186,7 @@
    1.64  /* tag.c */
    1.65  void initrregs(void);			/* initialize regexps of rules defined in config.h */
    1.66  Client *getnext(Client *c);		/* returns next visible client */
    1.67 -void setgroup(Client *c, Client *trans);	/* sets group of c */
    1.68 +void settag(Client *c, Client *trans);	/* sets tag of c */
    1.69  
    1.70  /* util.c */
    1.71  void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
    1.72 @@ -191,7 +200,7 @@
    1.73  void restack(void);			/* restores z layers of all clients */
    1.74  
    1.75  
    1.76 -void toggleview(void);			/* toggle the viewed group */
    1.77 +void toggleview(void);			/* toggle the view */
    1.78  void focusnext(void);		/* focuses next visible client  */
    1.79  void zoom(void);			/* zooms the focused client to master area */
    1.80  void killclient(void);		/* kill c nicely */
    1.81 @@ -200,7 +209,7 @@
    1.82  void togglefloat(void);		/* toggles focusesd client between floating/non-floating state */
    1.83  void incnmaster(void);		/* increments nmaster */
    1.84  void decnmaster(void);		/* decrements nmaster */
    1.85 -void togglegroup(void);		/* toggles c group */
    1.86 +void toggletag(void);		/* toggles tag of c */
    1.87  void spawn(const char* cmd);			/* forks a new subprocess with cmd */
    1.88  
    1.89  
    1.90 @@ -388,7 +397,7 @@
    1.91  
    1.92  Bool
    1.93  isvisible(Client *c) {
    1.94 -	return (c->group == selgroup);
    1.95 +	return (c->tag == seltag);
    1.96  }
    1.97  
    1.98  void
    1.99 @@ -444,7 +453,7 @@
   1.100  
   1.101  void
   1.102  toggleview() {
   1.103 -	selgroup = !selgroup;
   1.104 +	seltag = !seltag;
   1.105  	arrange();
   1.106  }
   1.107  
   1.108 @@ -578,7 +587,7 @@
   1.109  }
   1.110  
   1.111  void
   1.112 -setgroup(Client *c, Client *trans) {
   1.113 +settag(Client *c, Client *trans) {
   1.114  	char prop[512];
   1.115  	unsigned int i;
   1.116  	regmatch_t tmp;
   1.117 @@ -586,7 +595,7 @@
   1.118  	XClassHint ch = { 0 };
   1.119  
   1.120  	if(matched) {
   1.121 -		c->group = trans->group;
   1.122 +		c->tag = trans->tag;
   1.123  	} else {
   1.124  		XGetClassHint(dpy, c->win, &ch);
   1.125  		snprintf(prop, sizeof prop, "%s:%s:%s",
   1.126 @@ -595,12 +604,12 @@
   1.127  		for(i = 0; i < len && !matched; i++)
   1.128  			if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
   1.129  				c->isfloat = rule[i].isfloat;
   1.130 -				if (rule[i].group < 0) {
   1.131 -					c->group = selgroup;
   1.132 -				} else if (rule[i].group == 0) {
   1.133 -					c->group = True;
   1.134 +				if (rule[i].tag < 0) {
   1.135 +					c->tag = seltag;
   1.136 +				} else if (rule[i].tag) {
   1.137 +					c->tag = True;
   1.138  				} else {
   1.139 -					c->group = False;
   1.140 +					c->tag = False;
   1.141  				}
   1.142  				matched = True;
   1.143  			}
   1.144 @@ -610,15 +619,15 @@
   1.145  			XFree(ch.res_name);
   1.146  	}
   1.147  	if(!matched) {
   1.148 -		c->group = selgroup;
   1.149 +		c->tag = seltag;
   1.150  	}
   1.151  }
   1.152  
   1.153  void
   1.154 -togglegroup() {
   1.155 +toggletag() {
   1.156  	if(!sel)
   1.157  		return;
   1.158 -	sel->group = !sel->group;
   1.159 +	sel->tag = !sel->tag;
   1.160  	toggleview();
   1.161  }
   1.162  
   1.163 @@ -1047,11 +1056,11 @@
   1.164  	int x;
   1.165  
   1.166  	dc.x = dc.y = 0;
   1.167 -	dc.w = textw(NAMESEL);
   1.168 -	drawtext(NAMESEL, ( selgroup ? dc.sel : dc.norm ));
   1.169 +	dc.w = textw(NAMETAGGED);
   1.170 +	drawtext(NAMETAGGED, ( seltag ? dc.sel : dc.norm ));
   1.171  	dc.x += dc.w + 1;
   1.172 -	dc.w = textw(NAMENSEL);
   1.173 -	drawtext(NAMENSEL, ( selgroup ? dc.norm : dc.sel ));
   1.174 +	dc.w = textw(NAMEUNTAGGED);
   1.175 +	drawtext(NAMEUNTAGGED, ( seltag ? dc.norm : dc.sel ));
   1.176  	dc.x += dc.w + 1;
   1.177  	dc.w = bmw;
   1.178  	drawtext("", dc.norm);
   1.179 @@ -1283,7 +1292,7 @@
   1.180  	Window trans;
   1.181  
   1.182  	c = emallocz(sizeof(Client));
   1.183 -	c->group = True;
   1.184 +	c->tag = True;
   1.185  	c->win = w;
   1.186  	c->x = wa->x;
   1.187  	c->y = wa->y;
   1.188 @@ -1311,7 +1320,7 @@
   1.189  	grabbuttons(c, False);
   1.190  	XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
   1.191  	updatetitle(c);
   1.192 -	setgroup(c, getclient(trans));
   1.193 +	settag(c, getclient(trans));
   1.194  	if(!c->isfloat)
   1.195  		c->isfloat = trans || c->isfixed;
   1.196  	if(clients)
   1.197 @@ -1584,7 +1593,7 @@
   1.198  	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
   1.199  	grabkeys();
   1.200  	initrregs();
   1.201 -	selgroup = True;
   1.202 +	seltag = True;
   1.203  	/* style */
   1.204  	dc.norm[ColBG] = getcolor(NORMBGCOLOR);
   1.205  	dc.norm[ColFG] = getcolor(NORMFGCOLOR);
     2.1 --- a/config.h	Fri Dec 05 19:13:24 2008 +0100
     2.2 +++ b/config.h	Fri Dec 05 19:43:56 2008 +0100
     2.3 @@ -3,8 +3,8 @@
     2.4   * See LICENSE file for license details.
     2.5   */
     2.6  
     2.7 -#define NAMESEL "Das Alles"
     2.8 -#define NAMENSEL "Das Nichts"
     2.9 +#define NAMETAGGED "Das Alles"
    2.10 +#define NAMEUNTAGGED "Das Nichts"
    2.11  
    2.12  #define BORDERPX		1
    2.13  #define DEFMODE			domax		/* dotile */
    2.14 @@ -36,17 +36,17 @@
    2.15  	{ MODKEY|ShiftMask,		XK_space,	togglefloat,	"" }, \
    2.16  	{ MODKEY,			XK_plus,		incnmaster,	"" }, \
    2.17  	{ MODKEY,			XK_minus,		decnmaster,	"" }, \
    2.18 -	{ MODKEY,		XK_F3,		togglegroup,		"" }, \
    2.19 +	{ MODKEY,		XK_F3,		toggletag,		"" }, \
    2.20  };
    2.21  
    2.22  /* Query class:instance:title for regex matching info with following command:
    2.23   * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
    2.24  #define RULES \
    2.25  static Rule rule[] = { \
    2.26 -	/* class:instance:title regex, group (0=first/1=second/-1=curr), isfloat */ \
    2.27 -	{ "URxvt.*",	  	  	1,	    	False }, \
    2.28 +	/* class:instance:title regex, tag (1=tag/0=untag/-1=curr), isfloat */ \
    2.29 +	{ "URxvt.*",	  	  	0,	    	False }, \
    2.30  	{ "MPlayer.*",		  	-1,	    	True }, \
    2.31  	{ "qiv.*",		  	    -1,	    	False }, \
    2.32 -	{ "Gimp.*",	      		0,		True }, \
    2.33 -	{ ".*",		          	0,	    	False }, \
    2.34 +	{ "Gimp.*",	      		1,		True }, \
    2.35 +	{ ".*",		          	1,	    	False }, \
    2.36  };