~ is a magic tag which needs to be separated by case, merging of different tags works with the '+' operator, ie xwrite /ctl select 1+2

This commit is contained in:
Anselm R. Garbe 2006-03-13 20:27:33 +01:00
parent 3eea13a29b
commit ae43c939d8
2 changed files with 11 additions and 12 deletions

View File

@ -153,21 +153,23 @@ get_tag(char *name)
char buf[256];
char *tags[128];
fprintf(stderr, "get_tag %s\n", name);
for(i = 0; i < ntag; i++) {
t = tag[i];
if(!strncmp(t->name, name, strlen(t->name)))
if(!strncmp(t->name, name, strlen(name)))
return t;
}
cext_strlcpy(buf, name, sizeof(buf));
nt = cext_tokenize(tags, 128, buf, ' ');
nt = cext_tokenize(tags, 128, buf, '+');
fprintf(stderr, "get_tag nt=%d\n", nt);
for(i = 0; i < nclient; i++)
for(j = 0; j < nt; j++)
if(strstr(client[i]->tags, tags[j]))
n++;
fprintf(stderr, "get_tag %d\n", n);
fprintf(stderr, "get_tag n=%d\n", n);
if(!n)
return nil;
@ -186,6 +188,7 @@ select_tag(char *arg)
int i, j, n;
Client *c;
Tag *t = get_tag(arg);
if(!t)
return;
focus_tag(t);
@ -221,7 +224,6 @@ update_tags()
unsigned int i, j, k;
char buf[256];
char *tags[128];
char *t;
char **newctag = nil;
unsigned int newctagsz = 0;
@ -231,13 +233,10 @@ update_tags()
cext_strlcpy(buf, client[i]->tags, sizeof(buf));
j = cext_tokenize(tags, 128, buf, ' ');
for(k = 0; k < j; k++) {
t = tags[k];
if(*t == '~')
t++;
if(!*t) /* should not happen, but some user might try */
if(!strncmp(tags[k], "~", 2)) /* magic floating tag */
continue;
if(!istag(newctag, t, nnewctag)) {
newctag = (char **)cext_array_attach((void **)newctag, strdup(t),
if(!istag(newctag, tags[k], nnewctag)) {
newctag = (char **)cext_array_attach((void **)newctag, strdup(tags[k]),
sizeof(char *), &newctagsz);
nnewctag++;
}

View File

@ -37,8 +37,8 @@ xwrite /ws/tag 1
# TAGGING RULES
wmiir write /def/rules <<EOF
/XMMS:.*/ -> ~0
/Gimp.*:.*/ -> ~3
/XMMS:.*/ -> ~
/Gimp.*:.*/ -> ~
EOF
# BAR CONFIGURATION