diff --git a/cmd/wm/area.c b/cmd/wm/area.c index 8941c67d..1dbcea0e 100644 --- a/cmd/wm/area.c +++ b/cmd/wm/area.c @@ -235,9 +235,29 @@ place_client(Area *a, Client *c) free(rects); } +static unsigned int +ncol_of_view(View *v) +{ + unsigned int i, n; + regmatch_t tmpregm; + + for(i = 0; i < vrule.size; i++) { + Rule *r = vrule.data[i]; + if(!regexec(&r->regex, v->name, 1, &tmpregm, 0)) { + if(sscanf(r->values, "%u", &n) == 1) { + fprintf(stderr, "r->values=%s n=%d\n", r->values, n); + return n; + } + fprintf(stderr, "r->values=%s n=%d\n", r->values, n); + } + } + return 0; +} + void attach_to_area(Area *a, Client *c) { + View *v = a->view; unsigned int h = 0, aidx = idx_of_area(a); Frame *f; @@ -248,6 +268,13 @@ attach_to_area(Area *a, Client *c) scale_column(a, a->rect.height - h); } + if(aidx) { /* column */ + unsigned int nc = ncol_of_view(v); + fprintf(stderr, "nc=%d v->area.size=%d\n", nc, v->area.size); + if(nc && nc > v->area.size - 1) + a = create_area(v, v->sel); + } + f = create_frame(a, c); if(aidx) { /* column */ diff --git a/cmd/wm/rule.c b/cmd/wm/rule.c index 4edfc1ad..6b074ac0 100644 --- a/cmd/wm/rule.c +++ b/cmd/wm/rule.c @@ -38,7 +38,7 @@ update_rules(RuleVector *rule, const char *data) free(rul); } - for(p = def.rules; *p; p++) + for(p = (char *)data; *p; p++) switch(mode) { case IGNORE: if(*p == '/') {