wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit ae43c939d83a8b78079151835c90261aa5e6d12f
parent 3eea13a29bbb5c7f2ee6da6453320666cf97fe69
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Mon, 13 Mar 2006 20:27:33 +0100

~ 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


Diffstat:
cmd/wm/tag.c | 19+++++++++----------
rc/wmiirc | 4++--
2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c @@ -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++; } diff --git a/rc/wmiirc b/rc/wmiirc @@ -37,8 +37,8 @@ xwrite /ws/tag 1 # TAGGING RULES wmiir write /def/rules <<EOF -/XMMS:.*/ -> ~0 -/Gimp.*:.*/ -> ~3 +/XMMS:.*/ -> ~ +/Gimp.*:.*/ -> ~ EOF # BAR CONFIGURATION