specific last match for autogroup; few iterations with Kent Spillner.

This commit is contained in:
okan 2012-11-29 04:25:49 +00:00
parent 7edabe94f2
commit 560acb43fc
2 changed files with 9 additions and 6 deletions

View File

@ -50,6 +50,7 @@ or if their name and class properties match
and
.Ar windowclass ,
respectively.
The more specific last match wins.
.Ar group
is a number between 0 and 9.
If

14
group.c
View File

@ -412,7 +412,7 @@ group_autogroup(struct client_ctx *cc)
struct screen_ctx *sc = cc->sc;
struct autogroupwin *aw;
struct group_ctx *gc;
int no = -1;
int no = -1, both_match = 0;
long *grpno;
if (cc->app_class == NULL || cc->app_name == NULL)
@ -429,11 +429,13 @@ group_autogroup(struct client_ctx *cc)
XFree(grpno);
} else {
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
if (strcmp(aw->class, cc->app_class) == 0 &&
(aw->name == NULL ||
strcmp(aw->name, cc->app_name) == 0)) {
no = aw->num;
break;
if (strcmp(aw->class, cc->app_class) == 0) {
if ((aw->name != NULL) &&
(strcmp(aw->name, cc->app_name) == 0)) {
no = aw->num;
both_match = 1;
} else if (aw->name == NULL && !both_match)
no = aw->num;
}
}
}