2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
13 if((clients && clients->isfloat) || arrange == dofloat)
14 return clients; /* don't touch floating order */
15 for(min = c = clients; c; c = c->next)
16 if(c->weight < min->weight)
22 nexttiled(Client *c) {
23 for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
29 Client *c, *newclients, *tail;
31 newclients = tail = NULL;
32 while((c = minclient())) {
40 tail = newclients = c;
49 if((c->ismax = !c->ismax)) {
50 c->rx = c->x; c->x = sx;
51 c->ry = c->y; c->y = bh;
52 c->rw = c->w; c->w = sw - 2 * BORDERPX;
53 c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
61 resize(c, True, TopLeft);
62 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
67 void (*arrange)(Arg *) = DEFMODE;
72 c->prev->next = c->next;
74 c->next->prev = c->prev;
77 c->next = c->prev = NULL;
84 for(c = clients; c; c = c->next) {
86 resize(c, True, TopLeft);
91 if(!sel || !isvisible(sel)) {
92 for(c = stack; c && !isvisible(c); c = c->snext);
104 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
108 h = (sh - bh) / (n - 1);
112 for(i = 0, c = clients; c; c = c->next) {
115 resize(c, True, TopLeft);
122 c->w = sw - 2 * BORDERPX;
123 c->h = sh - 2 * BORDERPX - bh;
128 c->w = mw - 2 * BORDERPX;
129 c->h = sh - 2 * BORDERPX - bh;
133 c->y = sy + (i - 1) * h + bh;
134 c->w = w - 2 * BORDERPX;
136 c->h = sh - c->y - 2 * BORDERPX;
138 c->h = h - 2 * BORDERPX;
140 else { /* fallback if h < bh */
143 c->w = w - 2 * BORDERPX;
144 c->h = sh - 2 * BORDERPX - bh;
146 resize(c, False, TopLeft);
152 if(!sel || !isvisible(sel)) {
153 for(c = stack; c && !isvisible(c); c = c->snext);
160 focusnext(Arg *arg) {
166 if(!(c = getnext(sel->next)))
167 c = getnext(clients);
175 focusprev(Arg *arg) {
181 if(!(c = getprev(sel->prev))) {
182 for(c = clients; c && c->next; c = c->next);
192 isvisible(Client *c) {
195 for(i = 0; i < ntags; i++)
196 if(c->tags[i] && seltag[i])
202 resizecol(Arg *arg) {
206 for(n = 0, c = clients; c; c = c->next)
207 if(isvisible(c) && !c->isfloat)
209 if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
212 if(sel == getnext(clients)) {
213 if(mw + arg->i > sw - 100 || mw + arg->i < 100)
218 if(mw - arg->i > sw - 100 || mw - arg->i < 100)
234 if(sel->isfloat || arrange == dofloat) {
235 XRaiseWindow(dpy, sel->win);
236 XRaiseWindow(dpy, sel->twin);
238 if(arrange != dofloat)
239 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
240 XLowerWindow(dpy, c->twin);
241 XLowerWindow(dpy, c->win);
245 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
249 togglemode(Arg *arg) {
250 arrange = (arrange == dofloat) ? dotile : dofloat;
258 toggleview(Arg *arg) {
261 seltag[arg->i] = !seltag[arg->i];
262 for(i = 0; i < ntags && !seltag[i]; i++);
264 seltag[arg->i] = True; /* cannot toggle last view */
273 for(i = 0; i < ntags; i++)
275 seltag[arg->i] = True;
284 for(i = 0; i < ntags; i++)
298 if(sel->isfloat || (arrange == dofloat)) {
303 for(n = 0, c = clients; c; c = c->next)
304 if(isvisible(c) && !c->isfloat)
306 if(n < 2 || (arrange == dofloat))
309 if((c = sel) == nexttiled(clients))
310 if(!(c = nexttiled(c->next)))