merged focus{prev.next} into focusclient(1/-1)
This commit is contained in:
parent
12d5a26fd2
commit
27b0595af7
4 changed files with 21 additions and 26 deletions
|
@ -52,8 +52,8 @@ static Key key[] = { \
|
||||||
{ MODKEY, XK_i, incnmaster, "1" }, \
|
{ MODKEY, XK_i, incnmaster, "1" }, \
|
||||||
{ MODKEY, XK_h, incmasterw, "-15" }, \
|
{ MODKEY, XK_h, incmasterw, "-15" }, \
|
||||||
{ MODKEY, XK_l, incmasterw, "15" }, \
|
{ MODKEY, XK_l, incmasterw, "15" }, \
|
||||||
{ MODKEY, XK_j, focusnext, NULL }, \
|
{ MODKEY, XK_j, focusclient, "1" }, \
|
||||||
{ MODKEY, XK_k, focusprev, NULL }, \
|
{ MODKEY, XK_k, focusclient, "-1" }, \
|
||||||
{ MODKEY, XK_m, togglemax, NULL }, \
|
{ MODKEY, XK_m, togglemax, NULL }, \
|
||||||
{ MODKEY, XK_Return, zoom, NULL }, \
|
{ MODKEY, XK_Return, zoom, NULL }, \
|
||||||
{ MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \
|
{ MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \
|
||||||
|
|
|
@ -48,8 +48,8 @@ static Key key[] = { \
|
||||||
{ MODKEY, XK_i, incnmaster, "1" }, \
|
{ MODKEY, XK_i, incnmaster, "1" }, \
|
||||||
{ MODKEY, XK_g, incmasterw, "15" }, \
|
{ MODKEY, XK_g, incmasterw, "15" }, \
|
||||||
{ MODKEY, XK_s, incmasterw, "-15" }, \
|
{ MODKEY, XK_s, incmasterw, "-15" }, \
|
||||||
{ MODKEY, XK_Tab, focusnext, NULL }, \
|
{ MODKEY, XK_Tab, focusclient, "1" }, \
|
||||||
{ MODKEY|ShiftMask, XK_Tab, focusprev, NULL }, \
|
{ MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \
|
||||||
{ MODKEY, XK_m, togglemax, NULL }, \
|
{ MODKEY, XK_m, togglemax, NULL }, \
|
||||||
{ MODKEY, XK_Return, zoom, NULL }, \
|
{ MODKEY, XK_Return, zoom, NULL }, \
|
||||||
{ MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \
|
{ MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \
|
||||||
|
|
3
dwm.h
3
dwm.h
|
@ -119,8 +119,7 @@ extern unsigned int textw(const char *text); /* return the width of text in px*/
|
||||||
extern void grabkeys(void); /* grab all keys defined in config.h */
|
extern void grabkeys(void); /* grab all keys defined in config.h */
|
||||||
|
|
||||||
/* layout.c */
|
/* layout.c */
|
||||||
extern void focusnext(const char *arg); /* focuses next visible client, arg is ignored */
|
extern void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */
|
||||||
extern void focusprev(const char *arg); /* focuses previous visible client, arg is ignored */
|
|
||||||
extern void incmasterw(const char *arg); /* increments the master width with arg's index value */
|
extern void incmasterw(const char *arg); /* increments the master width with arg's index value */
|
||||||
extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */
|
extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */
|
||||||
extern void initlayouts(void); /* initialize layout array */
|
extern void initlayouts(void); /* initialize layout array */
|
||||||
|
|
36
layout.c
36
layout.c
|
@ -70,30 +70,26 @@ LAYOUTS
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void
|
void
|
||||||
focusnext(const char *arg) {
|
focusclient(const char *arg) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!sel)
|
if(!sel || !arg)
|
||||||
return;
|
return;
|
||||||
for(c = sel->next; c && !isvisible(c); c = c->next);
|
switch(atoi(arg)) {
|
||||||
if(!c)
|
default:
|
||||||
for(c = clients; c && !isvisible(c); c = c->next);
|
|
||||||
if(c) {
|
|
||||||
focus(c);
|
|
||||||
restack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
focusprev(const char *arg) {
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
if(!sel)
|
|
||||||
return;
|
return;
|
||||||
for(c = sel->prev; c && !isvisible(c); c = c->prev);
|
case 1:
|
||||||
if(!c) {
|
for(c = sel->next; c && !isvisible(c); c = c->next);
|
||||||
for(c = clients; c && c->next; c = c->next);
|
if(!c)
|
||||||
for(; c && !isvisible(c); c = c->prev);
|
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) {
|
if(c) {
|
||||||
focus(c);
|
focus(c);
|
||||||
|
|
Loading…
Reference in a new issue