enabled /def/rules handling, added default /def/rules to wmiirc

This commit is contained in:
Anselm R. Garbe 2006-03-10 17:17:59 +01:00
parent 321ba8b56a
commit 9ce2bd40c4
5 changed files with 18 additions and 18 deletions

View File

@ -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();

View File

@ -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));

View File

@ -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];

View File

@ -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);

View File

@ -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