commit 3c5dd59018ee8b60a1b5320befb3c4c71e993fcd
parent 889aaed80fd3d19867e68f0c12705a8b9f4c1f94
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Tue, 14 Mar 2006 10:05:55 +0100
changed proglist in wmiirc, updated update_tags() to allow 'select tag(s)' ;)
Diffstat:
2 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c
@@ -161,7 +161,6 @@ get_tag(char *name)
cext_strlcpy(buf, name, sizeof(buf));
nt = cext_tokenize(tags, 128, buf, ' ');
-
for(i = 0; i < nclient; i++)
for(j = 0; j < nt; j++)
if(strstr(client[i]->tags, tags[j]))
@@ -172,9 +171,8 @@ get_tag(char *name)
t = alloc_tag(name);
for(i = 0; i < nclient; i++)
for(j = 0; j < nt; j++)
- if(strstr(client[i]->tags, tags[j]))
- if(!clientoftag(t, client[i]))
- attach_totag(t, client[i]);
+ if(strstr(client[i]->tags, tags[j]) && !clientoftag(t, client[i]))
+ attach_totag(t, client[i]);
return t;
}
@@ -217,7 +215,7 @@ clientoftag(Tag *t, Client *c)
void
update_tags()
{
- unsigned int i, j, k;
+ unsigned int i, j, k, nt;
char buf[256];
char *tags[128];
@@ -227,8 +225,8 @@ update_tags()
for(i = 0; i < nclient; i++) {
cext_strlcpy(buf, client[i]->tags, sizeof(buf));
- j = cext_tokenize(tags, 128, buf, ' ');
- for(k = 0; k < j; k++) {
+ nt = cext_tokenize(tags, 128, buf, ' ');
+ for(k = 0; k < nt; k++) {
if(!strncmp(tags[k], "~", 2)) /* magic floating tag */
continue;
if(!istag(newctag, nnewctag, tags[k])) {
@@ -260,14 +258,23 @@ update_tags()
for(i = 0; i < nclient; i++)
for(j = 0; j < ntag; j++) {
- if(strstr(client[i]->tags, tag[j]->name)) {
- if(!clientoftag(tag[j], client[i]))
- attach_totag(tag[j], client[i]);
- }
- else {
- if(clientoftag(tag[j], client[i]))
- detach_fromtag(tag[j], client[i]);
- }
+ int level = 0;
+ cext_strlcpy(buf, tag[j]->name, sizeof(buf));
+ nt = cext_tokenize(tags, 128, buf, ' ');
+ for(k = 0; k < nt; k++)
+ if(strstr(client[i]->tags, tags[k])) {
+ if(!clientoftag(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)
diff --git a/rc/wmiirc b/rc/wmiirc
@@ -7,12 +7,10 @@ xwrite() {
}
proglist() {
- for dir in `echo $@ | sed 's/^:/.:/; s/::/:.:/; s/:$/:./' | tr : ' '`
+ echo "$@" | tr ':' '\n' | grep -v '^$' | uniq |
+ while read dir
do
- for i in $dir/*
- do
- test -x "$i" && test ! -d "$i" && echo `basename "$i"`
- done
+ find "$dir" -perm -u+x -type f -print | sed 's,^.*/,,'
done | sort | uniq
}