# HG changeset patch
# User meillo@marmaro.de
# Date 1190322751 -7200
# Node ID 303286112f0a3fafa0ec318a489895d8a60db753
# Parent  19d4ccea9745e8c04e5a4a9278efcb73a22cf248
Meillos mods: toggletags, maxlayout, match only first rule, no squares, personalized config.h
(rem: code of maxlayout is from the monocle-patch, via mailinglist)

diff -r 19d4ccea9745 -r 303286112f0a dwm.c
--- a/dwm.c	Wed Sep 19 17:32:28 2007 +0200
+++ b/dwm.c	Thu Sep 20 23:12:31 2007 +0200
@@ -245,9 +246,14 @@ applyrules(Client *c) {
 	snprintf(buf, sizeof buf, "%s:%s:%s",
 			ch.res_class ? ch.res_class : "",
 			ch.res_name ? ch.res_name : "", c->name);
-	for(i = 0; i < nrules; i++)
+  /* perform only the first rule matching */
+	for(i = 0; i < nrules && !matched; i++)
 		if(regs[i].propregex && !regexec(regs[i].propregex, buf, 1, &tmp, 0)) {
 			c->isfloating = rules[i].isfloating;
+      /* use fallback match */
+      if (regs[i].tagregex == NULL) {
+        break;
+      }
 			for(j = 0; regs[i].tagregex && j < ntags; j++) {
 				if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
 					matched = True;
@@ -259,6 +265,7 @@ applyrules(Client *c) {
 		XFree(ch.res_class);
 	if(ch.res_name)
 		XFree(ch.res_name);
+  /* fallback match: all current viewed tags */
 	if(!matched)
 		for(i = 0; i < ntags; i++)
 			c->tags[i] = seltags[i];
