X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=tag.c;h=f7513c1270daf60187b748d06e8a9df98b18dd8c;hb=a73a88280681acdab047bd11a9ba77d97d6a0b72;hp=67e2498326a821ff32aa3f89fa89aaf1f9a49131;hpb=0464e42231199d7a6ea45e46cf7798f2b6cf972c;p=dwm.git diff --git a/tag.c b/tag.c index 67e2498..f7513c1 100644 --- a/tag.c +++ b/tag.c @@ -18,24 +18,10 @@ typedef struct { Bool isfloat; } Rule; -/* CUSTOMIZE */ -static Rule rule[] = { - /* class:instance tags isfloat */ - { "Firefox.*", { [Tnet] = "net" }, False }, - { "Gimp.*", { 0 }, True}, -}; +TAGS +RULES -char *tags[TLast] = { - [Tfnord] = "fnord", - [Tdev] = "dev", - [Tnet] = "net", - [Twork] = "work", - [Tmisc] = "misc", -}; - -void (*arrange)(Arg *) = dotile; - -/* END CUSTOMIZE */ +void (*arrange)(Arg *) = ARRANGE; /* extern */ @@ -63,10 +49,12 @@ dofloat(Arg *arg) ban(c); } if(sel && !sel->tags[tsel]) { - if((sel = getnext(clients, tsel))) { + if((sel = getnext(clients))) { higher(sel); focus(sel); } + else + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); } drawall(); } @@ -126,18 +114,20 @@ dotile(Arg *arg) ban(c); } if(!sel || (sel && !sel->tags[tsel])) { - if((sel = getnext(clients, tsel))) { + if((sel = getnext(clients))) { higher(sel); focus(sel); } + else + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); } drawall(); } Client * -getnext(Client *c, unsigned int t) +getnext(Client *c) { - for(; c && !c->tags[t]; c = c->next); + for(; c && !c->tags[tsel]; c = c->next); return c; } @@ -212,3 +202,17 @@ view(Arg *arg) arrange(NULL); drawall(); } + +void +viewnext(Arg *arg) +{ + arg->i = (tsel < TLast-1) ? tsel+1 : 0; + view(arg); +} + +void +viewprev(Arg *arg) +{ + arg->i = (tsel > 0) ? tsel-1 : TLast-1; + view(arg); +}