X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=layout.c;h=1e8f113484d834edd55d7c3d5c59c507f9ca7419;hb=27b0595af72060d7cc406639b6c53a854f0a3590;hp=5d43187d6af7e3e879573d50841158f9f504b7ec;hpb=12d5a26fd279cc2370954929dedf88d0ab205a16;p=dwm.git diff --git a/layout.c b/layout.c index 5d43187..1e8f113 100644 --- a/layout.c +++ b/layout.c @@ -70,30 +70,26 @@ LAYOUTS /* extern */ void -focusnext(const char *arg) { +focusclient(const char *arg) { Client *c; - if(!sel) + if(!sel || !arg) 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(const char *arg) { - Client *c; - - if(!sel) + switch(atoi(arg)) { + default: 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); + case 1: + for(c = sel->next; c && !isvisible(c); c = c->next); + if(!c) + for(c = clients; c && !isvisible(c); c = c->next); + break; + case -1: + 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); + } + break; } if(c) { focus(c);