X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=layout.c;h=e5f635c7542d4d0963cc7094d78fc51e2364783b;hb=52f0b9e2e3e7eba1e7d2b940863d9a72fa8112d6;hp=d754afbed24c95ba207f8273605ea11d6fd3d56b;hpb=8012fcf3334148d2b39646fd372a7514cc74c250;p=dwm.git diff --git a/layout.c b/layout.c index d754afb..e5f635c 100644 --- a/layout.c +++ b/layout.c @@ -68,6 +68,38 @@ LAYOUTS /* extern */ +void +focusnext(Arg *arg) { + Client *c; + + if(!sel) + return; + for(c = sel->next; c && !isvisible(c); c = c->next); + if(!c) + for(c = clients; c && !isvisible(c); c = c->next); + if(c) { + focus(c); + restack(); + } +} + +void +focusprev(Arg *arg) { + Client *c; + + if(!sel) + return; + for(c = sel->prev; c && !isvisible(c); c = c->prev); + if(!c) { + for(c = clients; c && c->next; c = c->next); + for(; c && !isvisible(c); c = c->prev); + } + if(c) { + focus(c); + restack(); + } +} + void incnmaster(Arg *arg) { if((lt->arrange != tile) || (nmaster + arg->i < 1) @@ -93,6 +125,12 @@ initlayouts(void) { } } +Client * +nexttiled(Client *c) { + for(; c && (c->isversatile || !isvisible(c)); c = c->next); + return c; +} + void resizemaster(Arg *arg) { if(lt->arrange != tile) @@ -153,14 +191,6 @@ setlayout(Arg *arg) { drawstatus(); } -void -toggleversatile(Arg *arg) { - if(!sel || lt->arrange == versatile) - return; - sel->isversatile = !sel->isversatile; - lt->arrange(); -} - void versatile(void) { Client *c;