-dotile(Arg *arg)
-{
- Client *c;
- int n, i, w, h;
-
- w = sw - mw;
- arrange = dotile;
- for(n = 0, c = clients; c; c = c->next)
- if(c->tags[tsel] && !c->isfloat)
- n++;
-
- if(n > 1)
- h = (sh - bh) / (n - 1);
- else
- h = sh - bh;
-
- for(i = 0, c = clients; c; c = c->next) {
- setgeom(c);
- if(c->tags[tsel]) {
- if(c->isfloat) {
- higher(c);
- resize(c, True);
- continue;
- }
- if(n == 1) {
- *c->x = sx;
- *c->y = sy + bh;
- *c->w = sw - 2 * c->border;
- *c->h = sh - 2 * c->border - bh;
- }
- else if(i == 0) {
- *c->x = sx;
- *c->y = sy + bh;
- *c->w = mw - 2 * c->border;
- *c->h = sh - 2 * c->border - bh;
- }
- else {
- *c->x = sx + mw;
- *c->y = sy + (i - 1) * h + bh;
- *c->w = w - 2 * c->border;
- *c->h = h - 2 * c->border;
+settags(Client *c, Client *trans) {
+ char prop[512];
+ unsigned int i, j;
+ regmatch_t tmp;
+ Bool matched = trans != NULL;
+ XClassHint ch = { 0 };
+
+ if(matched)
+ for(i = 0; i < ntags; i++)
+ c->tags[i] = trans->tags[i];
+ else {
+ XGetClassHint(dpy, c->win, &ch);
+ snprintf(prop, sizeof prop, "%s:%s:%s",
+ ch.res_class ? ch.res_class : "",
+ ch.res_name ? ch.res_name : "", c->name);
+ for(i = 0; i < len; i++)
+ if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
+ c->isfloat = rule[i].isfloat;
+ for(j = 0; rreg[i].tregex && j < ntags; j++) {
+ if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) {
+ matched = True;
+ c->tags[j] = True;
+ }
+ }