# HG changeset patch # User markus schnalke # Date 1315256708 -7200 # Node ID f1e806b346974679274f480a20a42db2fa35ca1c # Parent 1ec698ca43c57b61b5a48665f3a10fe465110633 created separated floating space; added per space mode Eventually I realized the plans I had for so long. diff -r 1ec698ca43c5 -r f1e806b34697 aewl.c --- a/aewl.c Mon Sep 05 21:32:16 2011 +0200 +++ b/aewl.c Mon Sep 05 23:05:08 2011 +0200 @@ -127,11 +127,14 @@ unsigned int nmaster; /* number of master clients */ unsigned int numlockmask; /* dynamic lock mask */ void (*handler[LASTEvent])(XEvent *); /* event handler */ -void (*arrange)(void); /* arrange function, indicates mode */ +void arrange(void); /* arrange */ +void (*arrange1)(void); /* arrange function, indicates mode */ +void (*arrange2)(void); /* arrange function, indicates mode */ Atom wmatom[WMLast], netatom[NetLast]; Bool running = True; Bool selscreen = True; Bool seltag; +Bool viewfloats; Client* clients = NULL; /* global client list */ Client* stack = NULL; /* global client stack */ Client* sel = NULL; /* selected client */ @@ -179,11 +182,12 @@ void restack(void); /* restores z layers of all clients */ void toggleview(void); /* toggle the view */ +void floattoggle(); /* toggle floatsview */ void focusnext(void); /* focuses next visible client */ void zoom(void); /* zooms the focused client to master area */ void killclient(void); /* kill c nicely */ void quit(void); /* quit nicely */ -void togglemode(void); /* toggles global arrange function (dotile/domax) */ +void togglemode(void); /* toggles arrange function (dotile/domax) */ void togglefloat(void); /* toggles focusesd client between floating/non-floating state */ void incnmaster(void); /* increments nmaster */ void decnmaster(void); /* decrements nmaster */ @@ -362,7 +366,10 @@ Bool isvisible(Client *c) { - return (c->tag == seltag); + if (c->isfloat) { + return viewfloats; + } + return (!viewfloats && c->tag == seltag); } void @@ -373,9 +380,10 @@ drawbar(); if(!sel) return; - if(sel->isfloat) + /*if(sel->isfloat)*/ XRaiseWindow(dpy, sel->win); + /* if(!sel->isfloat) XLowerWindow(dpy, sel->win); for(c = nexttiled(clients); c; c = nexttiled(c->next)) { @@ -383,6 +391,7 @@ continue; XLowerWindow(dpy, c->win); } + */ XSync(dpy, False); while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); @@ -393,25 +402,50 @@ if (!sel) return; sel->isfloat = !sel->isfloat; - arrange(); + floattoggle(); } void togglemode() { - /* only toggle between tile and max - float is just available through togglefloat */ - arrange = (arrange == dotile) ? domax : dotile; + /* toggle between tile and max */ + if (viewfloats) { + return; + } + if (seltag) { + arrange1 = (arrange1 == dotile) ? domax : dotile; + } else { + arrange2 = (arrange2 == dotile) ? domax : dotile; + } if(sel) arrange(); zoom(); } void +arrange() { + if (seltag) { + arrange1(); + } else { + arrange2(); + } +} + +void toggleview() { + if (viewfloats) { + return; + } seltag = !seltag; arrange(); } void +floattoggle() { + viewfloats = !viewfloats; + arrange(); +} + +void zoom() { unsigned int n; Client *c; @@ -916,7 +950,7 @@ /* views */ dc.x = dc.y = 0; dc.w = textw(NAMETAGGED); - drawtext(NAMETAGGED, ( seltag ? dc.sel : dc.norm )); + drawtext(NAMETAGGED, ( (seltag&&!viewfloats) ? dc.sel : dc.norm )); dc.x += dc.w; dc.w = BORDERPX; @@ -924,7 +958,7 @@ dc.x += dc.w; dc.w = textw(NAMEUNTAGGED); - drawtext(NAMEUNTAGGED, ( seltag ? dc.norm : dc.sel )); + drawtext(NAMEUNTAGGED, ( (!seltag&&!viewfloats) ? dc.sel : dc.norm )); dc.x += dc.w; dc.w = BORDERPX; @@ -1447,6 +1481,7 @@ XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); grabkeys(); seltag = True; + viewfloats = False; /* style */ dc.norm[ColBG] = getcolor(NORMBGCOLOR); dc.norm[ColFG] = getcolor(NORMFGCOLOR); @@ -1458,7 +1493,8 @@ sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); nmaster = NMASTER; - arrange = DEFMODE; + arrange1 = DEFMODE; + arrange2 = DEFMODE; /* bar */ dc.h = bh = dc.font.height + 2; wa.override_redirect = 1; diff -r 1ec698ca43c5 -r f1e806b34697 config.h --- a/config.h Mon Sep 05 21:32:16 2011 +0200 +++ b/config.h Mon Sep 05 23:05:08 2011 +0200 @@ -24,8 +24,9 @@ static Key key[] = { \ /* modifier key function argument */ \ { MODKEY|ShiftMask, XK_Return, spawn, "exec urxvt" }, \ - { MODKEY, XK_F1, toggleview, "" }, \ - { MODKEY, XK_F2, toggleview, "" }, \ + { MODKEY, XK_F1, toggleview, "" }, \ + { MODKEY, XK_F2, toggleview, "" }, \ + { MODKEY, XK_F3, floattoggle, "" }, \ { MODKEY, XK_Tab, focusnext, "" }, \ { MODKEY, XK_asciicircum, spawn, "dmenu_run -fn '"FONT"' "\ "-nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }, \ @@ -38,7 +39,7 @@ { MODKEY|ShiftMask, XK_space, togglefloat, "" }, \ { MODKEY, XK_plus, incnmaster, "" }, \ { MODKEY, XK_minus, decnmaster, "" }, \ - { MODKEY, XK_3, toggletag, "" }, \ + { MODKEY, XK_3, toggletag, "" }, \ }; /* Query class:instance:title for regex matching info with following command: