wmii

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

commit 4a579d62bcf655ebe3bd1d5f08aa4782eb85cbd3
parent 05856824c1887555be21b90655c817aa20b7be43
Author: Kris Maglione <bsdaemon@wmii.de>
Date:   Mon, 19 Jun 2006 22:40:45 -0400

Add /tag/sel/name; make sure all tags have bars at wmiirc startup


Diffstat:
cmd/wm/fs.c | 16+++++++++++++---
libixp/convert.c | 5+++--
rc/wmiirc | 14+++++++++++++-
3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c @@ -65,11 +65,11 @@ static char /* Constants */ enum { /* Dirs */ FsRoot, FsDClient, FsDClients, FsDBar, - FsDSClient, FsDTag, FsDTags, + FsDSClient, FsDTag, FsDTags, FsDSTag, /* Files */ FsFBar, FsFBorder, FsFCNorm, FsFCSel, FsFCctl, FsFCindex, FsFColRules, FsFCtags, - FsFEvent, FsFFont, FsFKeys, FsFRctl, + FsFEvent, FsFFont, FsFKeys, FsFRctl, FsFTname, FsFTagRules, FsFTctl, FsFTindex, FsFprops, RsFFont }; @@ -140,6 +140,11 @@ dirtab_tags[]= {{".", QTDIR, FsDTags, 0500|DMDIR }, dirtab_tag[]= {{".", QTDIR, FsDTag, 0500|DMDIR }, {"ctl", QTAPPEND, FsFTctl, 0200|DMAPPEND }, {"index", QTFILE, FsFTindex, 0400 }, + {nil}}, +dirtab_stag[]= {{".", QTDIR, FsDTag, 0500|DMDIR }, + {"ctl", QTAPPEND, FsFTctl, 0200|DMAPPEND }, + {"index", QTFILE, FsFTindex, 0400 }, + {"name", QTFILE, FsFTname, 0400 }, {nil}}; /* Writing the lists separately and using an array of their references * removes the need for casting and allows for C90 conformance, @@ -151,7 +156,8 @@ static Dirtab *dirtab[] = { [FsDClient] dirtab_client, [FsDSClient] dirtab_sclient, [FsDTags] dirtab_tags, - [FsDTag] dirtab_tag + [FsDTag] dirtab_tag, + [FsDSTag] dirtab_stag }; /* get_file/free_file save and reuse old FileId structs @@ -267,6 +273,7 @@ lookup_file(FileId *parent, char *name) file->id = sel->id; file->tab = *dir; file->tab.name = strdup("sel"); + file->tab.type = FsDSTag; }if(name) goto LastItem; } for(v=view; v; v=v->next) { @@ -484,6 +491,9 @@ fs_read(Req *r) { case FsFCtags: write_buf(r, (void *)f->client->tags, strlen(f->client->tags)); return respond(r, nil); + case FsFTname: + write_buf(r, (void *)f->view->name, strlen(f->view->name)); + return respond(r, nil); case FsFCindex: if(r->ifcall.offset) return respond(r, nil); diff --git a/libixp/convert.c b/libixp/convert.c @@ -137,10 +137,11 @@ ixp_unpack_string(unsigned char **msg, int *msize, char **string, unsigned short { ixp_unpack_u16(msg, msize, len); *string = nil; - if (*len && (!msize || (*msize -= *len) >= 0)) { + if (!msize || (*msize -= *len) >= 0) { /* XXX we don't really need emallocz here */ *string = cext_emallocz(*len+1); - memcpy(*string, *msg, *len); + if(*len) + memcpy(*string, *msg, *len); (*string)[*len] = 0; *msg += *len; } diff --git a/rc/wmiirc b/rc/wmiirc @@ -43,7 +43,7 @@ wmiir write /colrules <<EOF EOF # TAGGING RULES -wmiir write /def/tagrules <<EOF +wmiir write /tagrules <<EOF /XMMS.*/ -> ~ /Gimp.*/ -> ~ /MPlayer.*/ -> ~ @@ -102,6 +102,18 @@ $MODKEY-Shift-8 $MODKEY-Shift-9 EOF +# TAG BAR +seltag=`wmiir read /tag/sel/name` +for tag in `wmiir ls /tag | sed -e 's,/$,,; /^sel$/d'` +do + wmiir create /lbar/$tag + if [ "X$tag" = "X$seltag" ]; then + xwrite "/lbar/$tag" $WMII_SELCOLORS $tag + else + xwrite "/lbar/$tag" $WMII_NORMCOLORS $tag + fi +done + # EVENT LOOP wmiir read /event 2>/dev/null | while read event