2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
10 #include <sys/types.h>
11 #include <X11/Xutil.h>
24 void (*arrange)(Arg *) = DEFMODE;
34 sel->tags[arg->i] = tags[arg->i];
43 for(c = clients; c; c = c->next) {
46 resize(c, True, TopLeft);
51 if(sel && !sel->tags[tsel]) {
52 if((sel = getnext(clients))) {
57 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
69 for(n = 0, c = clients; c; c = c->next)
70 if(c->tags[tsel] && !c->isfloat)
74 h = (sh - bh) / (n - 1);
78 for(i = 0, c = clients; c; c = c->next) {
83 resize(c, True, TopLeft);
89 c->w = sw - 2 * c->border;
90 c->h = sh - 2 * c->border - bh;
95 c->w = mw - 2 * c->border;
96 c->h = sh - 2 * c->border - bh;
100 c->y = sy + (i - 1) * h + bh;
101 c->w = w - 2 * c->border;
102 c->h = h - 2 * c->border;
104 else { /* fallback if h < bh */
107 c->w = w - 2 * c->border;
108 c->h = sh - 2 * c->border - bh;
110 resize(c, False, TopLeft);
116 if(!sel || (sel && !sel->tags[tsel])) {
117 if((sel = getnext(clients))) {
122 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
130 for(; c && !c->tags[tsel]; c = c->next);
137 for(; c && !c->tags[tsel]; c = c->prev);
149 for(i = 0; i < TLast; i++)
158 static unsigned int len = sizeof(rule) / sizeof(rule[0]);
162 Bool matched = False;
165 if(XGetClassHint(dpy, c->win, &ch)) {
166 snprintf(classinst, sizeof(classinst), "%s:%s",
167 ch.res_class ? ch.res_class : "",
168 ch.res_name ? ch.res_name : "");
169 for(i = 0; !matched && i < len; i++) {
170 if(!regcomp(®ex, rule[i].pattern, 0)) {
171 if(!regexec(®ex, classinst, 1, &tmp, 0)) {
172 for(j = 0; j < TLast; j++) {
175 c->tags[j] = rule[i].tags[j];
177 c->isfloat = rule[i].isfloat;
188 c->tags[tsel] = tags[tsel];
194 arrange = arrange == dofloat ? dotile : dofloat;
209 arg->i = (tsel < TLast-1) ? tsel+1 : 0;
216 arg->i = (tsel > 0) ? tsel-1 : TLast-1;