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

This commit is contained in:
Kris Maglione 2006-06-19 22:40:45 -04:00
parent 05856824c1
commit 4a579d62bc
3 changed files with 29 additions and 6 deletions

View File

@ -65,11 +65,11 @@ static char
/* Constants */ /* Constants */
enum { /* Dirs */ enum { /* Dirs */
FsRoot, FsDClient, FsDClients, FsDBar, FsRoot, FsDClient, FsDClients, FsDBar,
FsDSClient, FsDTag, FsDTags, FsDSClient, FsDTag, FsDTags, FsDSTag,
/* Files */ /* Files */
FsFBar, FsFBorder, FsFCNorm, FsFCSel, FsFBar, FsFBorder, FsFCNorm, FsFCSel,
FsFCctl, FsFCindex, FsFColRules, FsFCtags, FsFCctl, FsFCindex, FsFColRules, FsFCtags,
FsFEvent, FsFFont, FsFKeys, FsFRctl, FsFEvent, FsFFont, FsFKeys, FsFRctl, FsFTname,
FsFTagRules, FsFTctl, FsFTindex, FsFprops, FsFTagRules, FsFTctl, FsFTindex, FsFprops,
RsFFont RsFFont
}; };
@ -140,6 +140,11 @@ dirtab_tags[]= {{".", QTDIR, FsDTags, 0500|DMDIR },
dirtab_tag[]= {{".", QTDIR, FsDTag, 0500|DMDIR }, dirtab_tag[]= {{".", QTDIR, FsDTag, 0500|DMDIR },
{"ctl", QTAPPEND, FsFTctl, 0200|DMAPPEND }, {"ctl", QTAPPEND, FsFTctl, 0200|DMAPPEND },
{"index", QTFILE, FsFTindex, 0400 }, {"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}}; {nil}};
/* Writing the lists separately and using an array of their references /* Writing the lists separately and using an array of their references
* removes the need for casting and allows for C90 conformance, * removes the need for casting and allows for C90 conformance,
@ -151,7 +156,8 @@ static Dirtab *dirtab[] = {
[FsDClient] dirtab_client, [FsDClient] dirtab_client,
[FsDSClient] dirtab_sclient, [FsDSClient] dirtab_sclient,
[FsDTags] dirtab_tags, [FsDTags] dirtab_tags,
[FsDTag] dirtab_tag [FsDTag] dirtab_tag,
[FsDSTag] dirtab_stag
}; };
/* get_file/free_file save and reuse old FileId structs /* 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->id = sel->id;
file->tab = *dir; file->tab = *dir;
file->tab.name = strdup("sel"); file->tab.name = strdup("sel");
file->tab.type = FsDSTag;
}if(name) goto LastItem; }if(name) goto LastItem;
} }
for(v=view; v; v=v->next) { for(v=view; v; v=v->next) {
@ -484,6 +491,9 @@ fs_read(Req *r) {
case FsFCtags: case FsFCtags:
write_buf(r, (void *)f->client->tags, strlen(f->client->tags)); write_buf(r, (void *)f->client->tags, strlen(f->client->tags));
return respond(r, nil); return respond(r, nil);
case FsFTname:
write_buf(r, (void *)f->view->name, strlen(f->view->name));
return respond(r, nil);
case FsFCindex: case FsFCindex:
if(r->ifcall.offset) if(r->ifcall.offset)
return respond(r, nil); return respond(r, nil);

View File

@ -137,9 +137,10 @@ ixp_unpack_string(unsigned char **msg, int *msize, char **string, unsigned short
{ {
ixp_unpack_u16(msg, msize, len); ixp_unpack_u16(msg, msize, len);
*string = nil; *string = nil;
if (*len && (!msize || (*msize -= *len) >= 0)) { if (!msize || (*msize -= *len) >= 0) {
/* XXX we don't really need emallocz here */ /* XXX we don't really need emallocz here */
*string = cext_emallocz(*len+1); *string = cext_emallocz(*len+1);
if(*len)
memcpy(*string, *msg, *len); memcpy(*string, *msg, *len);
(*string)[*len] = 0; (*string)[*len] = 0;
*msg += *len; *msg += *len;

View File

@ -43,7 +43,7 @@ wmiir write /colrules <<EOF
EOF EOF
# TAGGING RULES # TAGGING RULES
wmiir write /def/tagrules <<EOF wmiir write /tagrules <<EOF
/XMMS.*/ -> ~ /XMMS.*/ -> ~
/Gimp.*/ -> ~ /Gimp.*/ -> ~
/MPlayer.*/ -> ~ /MPlayer.*/ -> ~
@ -102,6 +102,18 @@ $MODKEY-Shift-8
$MODKEY-Shift-9 $MODKEY-Shift-9
EOF 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 # EVENT LOOP
wmiir read /event 2>/dev/null | wmiir read /event 2>/dev/null |
while read event while read event