aewl

changeset 782:f1e806b34697

created separated floating space; added per space mode Eventually I realized the plans I had for so long.
author markus schnalke <meillo@marmaro.de>
date Mon, 05 Sep 2011 23:05:08 +0200
parents 1ec698ca43c5
children 49a283c22ef4
files aewl.c config.h
diffstat 2 files changed, 50 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/aewl.c	Mon Sep 05 21:32:16 2011 +0200
     1.2 +++ b/aewl.c	Mon Sep 05 23:05:08 2011 +0200
     1.3 @@ -127,11 +127,14 @@
     1.4  unsigned int nmaster;		/* number of master clients */
     1.5  unsigned int numlockmask;		/* dynamic lock mask */
     1.6  void (*handler[LASTEvent])(XEvent *);	/* event handler */
     1.7 -void (*arrange)(void);			/* arrange function, indicates mode  */
     1.8 +void arrange(void);			/* arrange */
     1.9 +void (*arrange1)(void);			/* arrange function, indicates mode  */
    1.10 +void (*arrange2)(void);			/* arrange function, indicates mode  */
    1.11  Atom wmatom[WMLast], netatom[NetLast];
    1.12  Bool running = True;
    1.13  Bool selscreen = True;
    1.14  Bool seltag;
    1.15 +Bool viewfloats;
    1.16  Client* clients = NULL;		/* global client list */
    1.17  Client* stack = NULL;		/* global client stack */
    1.18  Client* sel = NULL;		/* selected client */
    1.19 @@ -179,11 +182,12 @@
    1.20  void restack(void);			/* restores z layers of all clients */
    1.21  
    1.22  void toggleview(void);			/* toggle the view */
    1.23 +void floattoggle();			/* toggle floatsview */
    1.24  void focusnext(void);		/* focuses next visible client  */
    1.25  void zoom(void);			/* zooms the focused client to master area */
    1.26  void killclient(void);		/* kill c nicely */
    1.27  void quit(void);			/* quit nicely */
    1.28 -void togglemode(void);		/* toggles global arrange function (dotile/domax) */
    1.29 +void togglemode(void);		/* toggles arrange function (dotile/domax) */
    1.30  void togglefloat(void);		/* toggles focusesd client between floating/non-floating state */
    1.31  void incnmaster(void);		/* increments nmaster */
    1.32  void decnmaster(void);		/* decrements nmaster */
    1.33 @@ -362,7 +366,10 @@
    1.34  
    1.35  Bool
    1.36  isvisible(Client *c) {
    1.37 -	return (c->tag == seltag);
    1.38 +	if (c->isfloat) {
    1.39 +		return viewfloats;
    1.40 +	}
    1.41 +	return (!viewfloats && c->tag == seltag);
    1.42  }
    1.43  
    1.44  void
    1.45 @@ -373,9 +380,10 @@
    1.46  	drawbar();
    1.47  	if(!sel)
    1.48  		return;
    1.49 -	if(sel->isfloat)
    1.50 +	/*if(sel->isfloat)*/
    1.51  		XRaiseWindow(dpy, sel->win);
    1.52  
    1.53 +	/*
    1.54  	if(!sel->isfloat)
    1.55  		XLowerWindow(dpy, sel->win);
    1.56  	for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
    1.57 @@ -383,6 +391,7 @@
    1.58  			continue;
    1.59  		XLowerWindow(dpy, c->win);
    1.60  	}
    1.61 +	*/
    1.62  
    1.63  	XSync(dpy, False);
    1.64  	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    1.65 @@ -393,25 +402,50 @@
    1.66  	if (!sel)
    1.67  		return;
    1.68  	sel->isfloat = !sel->isfloat;
    1.69 -	arrange();
    1.70 +	floattoggle();
    1.71  }
    1.72  
    1.73  void
    1.74  togglemode() {
    1.75 -  /* only toggle between tile and max - float is just available through togglefloat */
    1.76 -  arrange = (arrange == dotile) ? domax : dotile;
    1.77 +	/* toggle between tile and max */
    1.78 +	if (viewfloats) {
    1.79 +		return;
    1.80 +	}
    1.81 +	if (seltag) {
    1.82 +		arrange1 = (arrange1 == dotile) ? domax : dotile;
    1.83 +	} else {
    1.84 +		arrange2 = (arrange2 == dotile) ? domax : dotile;
    1.85 +	}
    1.86  	if(sel)
    1.87  		arrange();
    1.88  	zoom();
    1.89  }
    1.90  
    1.91  void
    1.92 +arrange() {
    1.93 +	if (seltag) {
    1.94 +		arrange1();
    1.95 +	} else {
    1.96 +		arrange2();
    1.97 +	}
    1.98 +}
    1.99 +
   1.100 +void
   1.101  toggleview() {
   1.102 +	if (viewfloats) {
   1.103 +		return;
   1.104 +	}
   1.105  	seltag = !seltag;
   1.106  	arrange();
   1.107  }
   1.108  
   1.109  void
   1.110 +floattoggle() {
   1.111 +	viewfloats = !viewfloats;
   1.112 +	arrange();
   1.113 +}
   1.114 +
   1.115 +void
   1.116  zoom() {
   1.117  	unsigned int n;
   1.118  	Client *c;
   1.119 @@ -916,7 +950,7 @@
   1.120  	/* views */
   1.121  	dc.x = dc.y = 0;
   1.122  	dc.w = textw(NAMETAGGED);
   1.123 -	drawtext(NAMETAGGED, ( seltag ? dc.sel : dc.norm ));
   1.124 +	drawtext(NAMETAGGED, ( (seltag&&!viewfloats) ? dc.sel : dc.norm ));
   1.125  
   1.126  	dc.x += dc.w;
   1.127  	dc.w = BORDERPX;
   1.128 @@ -924,7 +958,7 @@
   1.129  
   1.130  	dc.x += dc.w;
   1.131  	dc.w = textw(NAMEUNTAGGED);
   1.132 -	drawtext(NAMEUNTAGGED, ( seltag ? dc.norm : dc.sel ));
   1.133 +	drawtext(NAMEUNTAGGED, ( (!seltag&&!viewfloats) ? dc.sel : dc.norm ));
   1.134  
   1.135  	dc.x += dc.w;
   1.136  	dc.w = BORDERPX;
   1.137 @@ -1447,6 +1481,7 @@
   1.138  	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
   1.139  	grabkeys();
   1.140  	seltag = True;
   1.141 +	viewfloats = False;
   1.142  	/* style */
   1.143  	dc.norm[ColBG] = getcolor(NORMBGCOLOR);
   1.144  	dc.norm[ColFG] = getcolor(NORMFGCOLOR);
   1.145 @@ -1458,7 +1493,8 @@
   1.146  	sw = DisplayWidth(dpy, screen);
   1.147  	sh = DisplayHeight(dpy, screen);
   1.148  	nmaster = NMASTER;
   1.149 -	arrange = DEFMODE;
   1.150 +	arrange1 = DEFMODE;
   1.151 +	arrange2 = DEFMODE;
   1.152  	/* bar */
   1.153  	dc.h = bh = dc.font.height + 2;
   1.154  	wa.override_redirect = 1;
     2.1 --- a/config.h	Mon Sep 05 21:32:16 2011 +0200
     2.2 +++ b/config.h	Mon Sep 05 23:05:08 2011 +0200
     2.3 @@ -24,8 +24,9 @@
     2.4  static Key key[] = { \
     2.5  	/* modifier		key		function	argument */ \
     2.6  	{ MODKEY|ShiftMask,	XK_Return,	spawn,		"exec urxvt" }, \
     2.7 -	{ MODKEY,		XK_F1,		toggleview,		"" }, \
     2.8 -	{ MODKEY,		XK_F2,		toggleview,		"" }, \
     2.9 +	{ MODKEY,		XK_F1,		toggleview,	"" }, \
    2.10 +	{ MODKEY,		XK_F2,		toggleview,	"" }, \
    2.11 +	{ MODKEY,		XK_F3,		floattoggle,	"" }, \
    2.12  	{ MODKEY,		XK_Tab,		focusnext,	"" }, \
    2.13  	{ MODKEY,		XK_asciicircum,		spawn, "dmenu_run -fn '"FONT"' "\
    2.14  	         "-nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'"  }, \
    2.15 @@ -38,7 +39,7 @@
    2.16  	{ MODKEY|ShiftMask,	XK_space,	togglefloat,	"" }, \
    2.17  	{ MODKEY,		XK_plus,	incnmaster,	"" }, \
    2.18  	{ MODKEY,		XK_minus,	decnmaster,	"" }, \
    2.19 -	{ MODKEY,		XK_3,		toggletag,		"" }, \
    2.20 +	{ MODKEY,		XK_3,		toggletag,	"" }, \
    2.21  };
    2.22  
    2.23  /* Query class:instance:title for regex matching info with following command: