changed proglist in wmiirc, updated update_tags() to allow 'select tag(s)' ;)

This commit is contained in:
Anselm R. Garbe 2006-03-14 10:05:55 +01:00
parent 889aaed80f
commit 3c5dd59018
2 changed files with 25 additions and 20 deletions

View File

@ -161,7 +161,6 @@ get_tag(char *name)
cext_strlcpy(buf, name, sizeof(buf)); cext_strlcpy(buf, name, sizeof(buf));
nt = cext_tokenize(tags, 128, buf, ' '); nt = cext_tokenize(tags, 128, buf, ' ');
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]))
@ -172,9 +171,8 @@ get_tag(char *name)
t = alloc_tag(name); t = alloc_tag(name);
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]) && !clientoftag(t, client[i]))
if(!clientoftag(t, client[i])) attach_totag(t, client[i]);
attach_totag(t, client[i]);
return t; return t;
} }
@ -217,7 +215,7 @@ clientoftag(Tag *t, Client *c)
void void
update_tags() update_tags()
{ {
unsigned int i, j, k; unsigned int i, j, k, nt;
char buf[256]; char buf[256];
char *tags[128]; char *tags[128];
@ -227,8 +225,8 @@ update_tags()
for(i = 0; i < nclient; i++) { for(i = 0; i < nclient; i++) {
cext_strlcpy(buf, client[i]->tags, sizeof(buf)); cext_strlcpy(buf, client[i]->tags, sizeof(buf));
j = cext_tokenize(tags, 128, buf, ' '); nt = cext_tokenize(tags, 128, buf, ' ');
for(k = 0; k < j; k++) { for(k = 0; k < nt; k++) {
if(!strncmp(tags[k], "~", 2)) /* magic floating tag */ if(!strncmp(tags[k], "~", 2)) /* magic floating tag */
continue; continue;
if(!istag(newctag, nnewctag, tags[k])) { if(!istag(newctag, nnewctag, tags[k])) {
@ -260,14 +258,23 @@ update_tags()
for(i = 0; i < nclient; i++) for(i = 0; i < nclient; i++)
for(j = 0; j < ntag; j++) { for(j = 0; j < ntag; j++) {
if(strstr(client[i]->tags, tag[j]->name)) { int level = 0;
if(!clientoftag(tag[j], client[i])) cext_strlcpy(buf, tag[j]->name, sizeof(buf));
attach_totag(tag[j], client[i]); nt = cext_tokenize(tags, 128, buf, ' ');
} for(k = 0; k < nt; k++)
else { if(strstr(client[i]->tags, tags[k])) {
if(clientoftag(tag[j], client[i])) if(!clientoftag(tag[j], client[i]))
detach_fromtag(tag[j], client[i]); level++;
} }
else {
if(clientoftag(tag[j], client[i]))
level--;
}
if(level > 0)
attach_totag(tag[j], client[i]);
else if(level < 0)
detach_fromtag(tag[j], client[i]);
} }
if(!ntag && nctag) if(!ntag && nctag)

View File

@ -7,12 +7,10 @@ xwrite() {
} }
proglist() { proglist() {
for dir in `echo $@ | sed 's/^:/.:/; s/::/:.:/; s/:$/:./' | tr : ' '` echo "$@" | tr ':' '\n' | grep -v '^$' | uniq |
while read dir
do do
for i in $dir/* find "$dir" -perm -u+x -type f -print | sed 's,^.*/,,'
do
test -x "$i" && test ! -d "$i" && echo `basename "$i"`
done
done | sort | uniq done | sort | uniq
} }