When more than one autogroup matches a window the
last defined autogroup that matches both class and
name wins. If no autogroup matches both then the
last defined autogroup that only matches class wins.
Index: cwm/cwmrc.5
===================================================================
--- cwm.orig/cwmrc.5 2012-11-03 16:26:43.414490000 -0500
+++ cwm/cwmrc.5 2012-11-03 16:31:22.866566037 -0500
@@ -59,6 +59,17 @@
used to override
.Dq sticky group mode .
.Pp
+When more than one
+.Dq autogroup
+matches a window the last defined
+.Dq autogroup
+that matches both class and name wins.
+If no
+.Dq autogroup
+matches both then the last defined
+.Dq autogroup
+that only matches class wins.
+.Pp
The name and class values, respectively, for existing windows
may be obtained using
.Xr xprop 1 .
Index: cwm/group.c
===================================================================
--- cwm.orig/group.c 2012-11-03 16:26:43.414490000 -0500
+++ cwm/group.c 2012-11-03 16:33:42.817931551 -0500
@@ -427,7 +427,7 @@
struct screen_ctx *sc = cc->sc;
struct autogroupwin *aw;
struct group_ctx *gc;
- int no = -1;
+ int both_match = 0, no = -1;
long *grpno;
if (cc->app_class == NULL || cc->app_name == NULL)
@@ -444,11 +444,13 @@
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;
}
}
}