mirror of
https://github.com/0intro/wmii
synced 2024-11-26 07:39:37 +03:00
~ 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:
parent
3eea13a29b
commit
ae43c939d8
19
cmd/wm/tag.c
19
cmd/wm/tag.c
@ -153,21 +153,23 @@ get_tag(char *name)
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
char *tags[128];
|
char *tags[128];
|
||||||
|
|
||||||
|
fprintf(stderr, "get_tag %s\n", name);
|
||||||
for(i = 0; i < ntag; i++) {
|
for(i = 0; i < ntag; i++) {
|
||||||
t = tag[i];
|
t = tag[i];
|
||||||
if(!strncmp(t->name, name, strlen(t->name)))
|
if(!strncmp(t->name, name, strlen(name)))
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
cext_strlcpy(buf, name, sizeof(buf));
|
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(i = 0; i < nclient; i++)
|
||||||
for(j = 0; j < nt; j++)
|
for(j = 0; j < nt; j++)
|
||||||
if(strstr(client[i]->tags, tags[j]))
|
if(strstr(client[i]->tags, tags[j]))
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
fprintf(stderr, "get_tag %d\n", n);
|
fprintf(stderr, "get_tag n=%d\n", n);
|
||||||
if(!n)
|
if(!n)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
@ -186,6 +188,7 @@ select_tag(char *arg)
|
|||||||
int i, j, n;
|
int i, j, n;
|
||||||
Client *c;
|
Client *c;
|
||||||
Tag *t = get_tag(arg);
|
Tag *t = get_tag(arg);
|
||||||
|
|
||||||
if(!t)
|
if(!t)
|
||||||
return;
|
return;
|
||||||
focus_tag(t);
|
focus_tag(t);
|
||||||
@ -221,7 +224,6 @@ update_tags()
|
|||||||
unsigned int i, j, k;
|
unsigned int i, j, k;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char *tags[128];
|
char *tags[128];
|
||||||
char *t;
|
|
||||||
|
|
||||||
char **newctag = nil;
|
char **newctag = nil;
|
||||||
unsigned int newctagsz = 0;
|
unsigned int newctagsz = 0;
|
||||||
@ -231,13 +233,10 @@ update_tags()
|
|||||||
cext_strlcpy(buf, client[i]->tags, sizeof(buf));
|
cext_strlcpy(buf, client[i]->tags, sizeof(buf));
|
||||||
j = cext_tokenize(tags, 128, buf, ' ');
|
j = cext_tokenize(tags, 128, buf, ' ');
|
||||||
for(k = 0; k < j; k++) {
|
for(k = 0; k < j; k++) {
|
||||||
t = tags[k];
|
if(!strncmp(tags[k], "~", 2)) /* magic floating tag */
|
||||||
if(*t == '~')
|
|
||||||
t++;
|
|
||||||
if(!*t) /* should not happen, but some user might try */
|
|
||||||
continue;
|
continue;
|
||||||
if(!istag(newctag, t, nnewctag)) {
|
if(!istag(newctag, tags[k], nnewctag)) {
|
||||||
newctag = (char **)cext_array_attach((void **)newctag, strdup(t),
|
newctag = (char **)cext_array_attach((void **)newctag, strdup(tags[k]),
|
||||||
sizeof(char *), &newctagsz);
|
sizeof(char *), &newctagsz);
|
||||||
nnewctag++;
|
nnewctag++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user