* See LICENSE file for license details.
*/
#include "dwm.h"
+#include <stdlib.h>
unsigned int blw = 0;
Layout *lt = NULL;
if(c->isbanned)
XMoveWindow(dpy, c->win, c->x, c->y);
c->isbanned = False;
- if(c->isversatile)
+ if(c->isuntiled)
continue;
c->ismax = False;
nx = wax;
/* 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();
+ if(atoi(arg) < 0) {
+ 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);
+ }
}
-}
-
-void
-focusprev(const char *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);
+ else {
+ 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);
void
incnmaster(const char *arg) {
- int i = arg ? atoi(arg) : 0;
- if((lt->arrange != tile) || (nmaster + i < 1)
- || (wah / (nmaster + i) <= 2 * BORDERPX))
- return;
- nmaster += i;
+ int i;
+
+ if(!arg)
+ nmaster = NMASTER;
+ else {
+ i = atoi(arg);
+ if((lt->arrange != tile) || (nmaster + i < 1)
+ || (wah / (nmaster + i) <= 2 * BORDERPX))
+ return;
+ nmaster += i;
+ }
if(sel)
lt->arrange();
else
Client *
nexttiled(Client *c) {
- for(; c && (c->isversatile || !isvisible(c)); c = c->next);
+ for(; c && (c->isuntiled || !isvisible(c)); c = c->next);
return c;
}
drawstatus();
if(!sel)
return;
- if(sel->isversatile || lt->arrange == versatile)
+ if(sel->isuntiled || lt->arrange == untile)
XRaiseWindow(dpy, sel->win);
- if(lt->arrange != versatile) {
- if(!sel->isversatile)
+ if(lt->arrange != untile) {
+ if(!sel->isuntiled)
XLowerWindow(dpy, sel->win);
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
if(c == sel)
void
setlayout(const char *arg) {
- unsigned int i;
+ int i;
if(!arg) {
for(i = 0; i < nlayouts && lt != &layout[i]; i++);
togglemax(const char *arg) {
XEvent ev;
- if(!sel || (lt->arrange != versatile && !sel->isversatile) || sel->isfixed)
+ if(!sel || (lt->arrange != untile && !sel->isuntiled) || sel->isfixed)
return;
if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x;
}
void
-versatile(void) {
+untile(void) {
Client *c;
for(c = clients; c; c = c->next) {
unsigned int n;
Client *c;
- if(!sel || lt->arrange != tile || sel->isversatile)
+ if(!sel || lt->arrange != tile || sel->isuntiled)
return;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;