commit 9ce2bd40c4b11d6d2af623de5b2ab39848a078e5
parent 321ba8b56a8dc5a70e24e1fc4d030cd28b6ab2b8
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Fri, 10 Mar 2006 17:17:59 +0100
enabled /def/rules handling, added default /def/rules to wmiirc
Diffstat:
5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -39,13 +39,9 @@ alloc_client(Window w, XWindowAttributes *wa)
free(name.value);
}
if(XGetClassHint(dpy, c->win, &ch)) {
- ch.res_class = ch.res_name = nil;
- snprintf(c->classinst, sizeof(c->classinst), "%s:%s",
- ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : "");
- if(ch.res_class)
- XFree(ch.res_class);
- if(ch.res_name)
- XFree(ch.res_name);
+ snprintf(c->classinst, sizeof(c->classinst), "%s:%s", ch.res_class, ch.res_name);
+ XFree(ch.res_class);
+ XFree(ch.res_name);
}
fwa.override_redirect = 1;
fwa.background_pixmap = ParentRelative;
@@ -317,15 +313,11 @@ manage_client(Client *c)
{
Tag *t;
- if(c->trans) {
- c->tags[0] = '~';
- c->tags[1] = 0;
- }
- else
- c->tags[0] = 0;
+ match_tags(c);
t = ntag ? tag[sel] : alloc_tag(def.tag);
- cext_strlcat(c->tags, t->name, sizeof(c->tags));
+ if(!c->tags[0])
+ cext_strlcpy(c->tags, t->name, sizeof(c->tags));
update_tags();
diff --git a/cmd/wm/rule.c b/cmd/wm/rule.c
@@ -108,17 +108,19 @@ match(Rule *rule, unsigned int nrule, char *prop)
}
void
-match_tags(char *ruledef, Client *c)
+match_tags(Client *c)
{
unsigned int n;
- Rule *rules = parse(ruledef, &n);
+ Rule *rules = parse(def.rules, &n);
char *tags;
c->tags[0] = 0;
tags = match(rules, n, c->name);
+ fprintf(stderr, "match_tags tags=%s c->name=%s\n", tags, c->name);
if(strlen(tags))
cext_strlcat(c->tags, tags, sizeof(c->tags));
tags = match(rules, n, c->classinst);
+ fprintf(stderr, "match_tags tags=%s c->name=%s\n", tags, c->name);
if(strlen(tags))
cext_strlcat(c->tags, tags, sizeof(c->tags));
diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c
@@ -288,7 +288,7 @@ attach_totag(Tag *t, Client *c)
{
Area *a;
- if(strchr(c->tags, '~'))
+ if(c->trans || strchr(c->tags, '~'))
a = t->area[0];
else
a = t->area[t->sel];
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -286,7 +286,7 @@ void grab_mouse(Window w, unsigned long mod, unsigned int button);
void ungrab_mouse(Window w, unsigned long mod, unsigned int button);
/* rule.c */
-void match_tags(char *ruledef, Client *c);
+void match_tags(Client *c);
/* tag.c */
Tag *alloc_tag(char *name);
diff --git a/rc/wmiirc b/rc/wmiirc
@@ -34,6 +34,12 @@ xwrite /def/selcolors $WMII_SELCOLORS
xwrite /def/normcolors $WMII_NORMCOLORS
xwrite /ws/tag 1
+# TAGGING RULES
+wmiir write /def/rules <<EOF
+/Xmms:.*/ -> ~0
+/Gimp.*:.*/ -> ~3
+EOF
+
# BAR CONFIGURATION
wmiir create /bar/foo
xwrite /bar/foo/colors $WMII_SELCOLORS