summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-22 15:25:19 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-22 15:25:19 +0100
commit27b0595af72060d7cc406639b6c53a854f0a3590 (patch)
treead04556f3a70e67d2a2db1e159d1fccf75cf7e37
parentmade dwm.h more tidy (thx Jukka for the zoom() hint) (diff)
downloaddwm-27b0595af72060d7cc406639b6c53a854f0a3590.tar.gz
dwm-27b0595af72060d7cc406639b6c53a854f0a3590.zip
merged focus{prev.next} into focusclient(1/-1)
-rw-r--r--config.arg.h4
-rw-r--r--config.default.h4
-rw-r--r--dwm.h3
-rw-r--r--layout.c36
4 files changed, 21 insertions, 26 deletions
diff --git a/config.arg.h b/config.arg.h
index f137212..0740e00 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -52,8 +52,8 @@ static Key key[] = { \
52 { MODKEY, XK_i, incnmaster, "1" }, \ 52 { MODKEY, XK_i, incnmaster, "1" }, \
53 { MODKEY, XK_h, incmasterw, "-15" }, \ 53 { MODKEY, XK_h, incmasterw, "-15" }, \
54 { MODKEY, XK_l, incmasterw, "15" }, \ 54 { MODKEY, XK_l, incmasterw, "15" }, \
55 { MODKEY, XK_j, focusnext, NULL }, \ 55 { MODKEY, XK_j, focusclient, "1" }, \
56 { MODKEY, XK_k, focusprev, NULL }, \ 56 { MODKEY, XK_k, focusclient, "-1" }, \
57 { MODKEY, XK_m, togglemax, NULL }, \ 57 { MODKEY, XK_m, togglemax, NULL }, \
58 { MODKEY, XK_Return, zoom, NULL }, \ 58 { MODKEY, XK_Return, zoom, NULL }, \
59 { MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \ 59 { MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \
diff --git a/config.default.h b/config.default.h
index d8ec858..d629899 100644
--- a/config.default.h
+++ b/config.default.h
@@ -48,8 +48,8 @@ static Key key[] = { \
48 { MODKEY, XK_i, incnmaster, "1" }, \ 48 { MODKEY, XK_i, incnmaster, "1" }, \
49 { MODKEY, XK_g, incmasterw, "15" }, \ 49 { MODKEY, XK_g, incmasterw, "15" }, \
50 { MODKEY, XK_s, incmasterw, "-15" }, \ 50 { MODKEY, XK_s, incmasterw, "-15" }, \
51 { MODKEY, XK_Tab, focusnext, NULL }, \ 51 { MODKEY, XK_Tab, focusclient, "1" }, \
52 { MODKEY|ShiftMask, XK_Tab, focusprev, NULL }, \ 52 { MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \
53 { MODKEY, XK_m, togglemax, NULL }, \ 53 { MODKEY, XK_m, togglemax, NULL }, \
54 { MODKEY, XK_Return, zoom, NULL }, \ 54 { MODKEY, XK_Return, zoom, NULL }, \
55 { MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \ 55 { MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \
diff --git a/dwm.h b/dwm.h
index 9e04a81..538018a 100644
--- a/dwm.h
+++ b/dwm.h
@@ -119,8 +119,7 @@ extern unsigned int textw(const char *text); /* return the width of text in px*/
119extern void grabkeys(void); /* grab all keys defined in config.h */ 119extern void grabkeys(void); /* grab all keys defined in config.h */
120 120
121/* layout.c */ 121/* layout.c */
122extern void focusnext(const char *arg); /* focuses next visible client, arg is ignored */ 122extern void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */
123extern void focusprev(const char *arg); /* focuses previous visible client, arg is ignored */
124extern void incmasterw(const char *arg); /* increments the master width with arg's index value */ 123extern void incmasterw(const char *arg); /* increments the master width with arg's index value */
125extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */ 124extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */
126extern void initlayouts(void); /* initialize layout array */ 125extern void initlayouts(void); /* initialize layout array */
diff --git a/layout.c b/layout.c
index 5d43187..1e8f113 100644
--- a/layout.c
+++ b/layout.c
@@ -70,30 +70,26 @@ LAYOUTS
70/* extern */ 70/* extern */
71 71
72void 72void
73focusnext(const char *arg) { 73focusclient(const char *arg) {
74 Client *c; 74 Client *c;
75 75
76 if(!sel) 76 if(!sel || !arg)
77 return; 77 return;
78 for(c = sel->next; c && !isvisible(c); c = c->next); 78 switch(atoi(arg)) {
79 if(!c) 79 default:
80 for(c = clients; c && !isvisible(c); c = c->next);
81 if(c) {
82 focus(c);
83 restack();
84 }
85}
86
87void
88focusprev(const char *arg) {
89 Client *c;
90
91 if(!sel)
92 return; 80 return;
93 for(c = sel->prev; c && !isvisible(c); c = c->prev); 81 case 1:
94 if(!c) { 82 for(c = sel->next; c && !isvisible(c); c = c->next);
95 for(c = clients; c && c->next; c = c->next); 83 if(!c)
96 for(; c && !isvisible(c); c = c->prev); 84 for(c = clients; c && !isvisible(c); c = c->next);
85 break;
86 case -1:
87 for(c = sel->prev; c && !isvisible(c); c = c->prev);
88 if(!c) {
89 for(c = clients; c && c->next; c = c->next);
90 for(; c && !isvisible(c); c = c->prev);
91 }
92 break;
97 } 93 }
98 if(c) { 94 if(c) {
99 focus(c); 95 focus(c);