-dofloat(Arg *arg)
-{
- Client *c;
-
- arrange = dofloat;
- for(c = clients; c; c = c->next) {
- if(c->tags[tsel])
- resize(c, True);
- else
- ban(c);
- }
- if(sel && !sel->tags[tsel]) {
- if((sel = getnext(clients, tsel))) {
- higher(sel);
- focus(sel);
+applyrules(Client *c) {
+ unsigned int i, j;
+ regmatch_t tmp;
+ Bool matched = False;
+ XClassHint ch = { 0 };
+
+ /* rule matching */
+ 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 < nrules; i++)
+ if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
+ c->isfloating = rules[i].isfloating;
+ for(j = 0; regs[i].tagregex && j < ntags; j++) {
+ if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
+ matched = True;
+ c->tags[j] = True;
+ }
+ }