summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-05-11 14:40:37 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-05-11 14:40:37 +0100
commit5602f44b29b5c9a9b66b012b34f5749929c5cd31 (patch)
tree18cd47f98c6acce2a1a32bc098fbc71e9389c497
parentapplied the proposal by nsz (diff)
downloaddwm-5602f44b29b5c9a9b66b012b34f5749929c5cd31.tar.gz
dwm-5602f44b29b5c9a9b66b012b34f5749929c5cd31.zip
implemented exact focus next, if arg != NULL to focus{next,prev}
Diffstat (limited to '')
-rw-r--r--config.def.h2
-rw-r--r--config.mk4
-rw-r--r--dwm.16
-rw-r--r--dwm.c32
4 files changed, 27 insertions, 17 deletions
diff --git a/config.def.h b/config.def.h
index ed3f624..d7824e3 100644
--- a/config.def.h
+++ b/config.def.h
@@ -53,7 +53,9 @@ Key keys[] = {
53 "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }, 53 "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
54 { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, 54 { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" },
55 { MODKEY, XK_j, focusnext, NULL }, 55 { MODKEY, XK_j, focusnext, NULL },
56 { MODKEY|ShiftMask, XK_j, focusnext, "exact" },
56 { MODKEY, XK_k, focusprev, NULL }, 57 { MODKEY, XK_k, focusprev, NULL },
58 { MODKEY|ShiftMask, XK_k, focusprev, "exact" },
57 { MODKEY, XK_r, reapply, NULL }, 59 { MODKEY, XK_r, reapply, NULL },
58 { MODKEY, XK_h, setmfact, "-0.05" }, 60 { MODKEY, XK_h, setmfact, "-0.05" },
59 { MODKEY, XK_l, setmfact, "+0.05" }, 61 { MODKEY, XK_l, setmfact, "+0.05" },
diff --git a/config.mk b/config.mk
index b18ad33..f2750fb 100644
--- a/config.mk
+++ b/config.mk
@@ -17,8 +17,8 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
17# flags 17# flags
18CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\" 18CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
19LDFLAGS = -s ${LIBS} 19LDFLAGS = -s ${LIBS}
20#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" 20CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
21#LDFLAGS = -g ${LIBS} 21LDFLAGS = -g ${LIBS}
22 22
23# Solaris 23# Solaris
24#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" 24#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
diff --git a/dwm.1 b/dwm.1
index a9f8cee..fc750de 100644
--- a/dwm.1
+++ b/dwm.1
@@ -66,9 +66,15 @@ Toggles between geometries.
66.B Mod1\-j 66.B Mod1\-j
67Focus next window. 67Focus next window.
68.TP 68.TP
69.B Mod1\-Shift\-j
70Focus next window with exactly the same tags as the current one.
71.TP
69.B Mod1\-k 72.B Mod1\-k
70Focus previous window. 73Focus previous window.
71.TP 74.TP
75.B Mod1\-Shift\-k
76Focus previous window with exactly the same tags as the current one.
77.TP
72.B Mod1\-h 78.B Mod1\-h
73Decrease master area size. 79Decrease master area size.
74.TP 80.TP
diff --git a/dwm.c b/dwm.c
index 997a220..56ca615 100644
--- a/dwm.c
+++ b/dwm.c
@@ -160,7 +160,7 @@ void initfont(const char *fontstr);
160Bool isoccupied(unsigned int t); 160Bool isoccupied(unsigned int t);
161Bool isprotodel(Client *c); 161Bool isprotodel(Client *c);
162Bool isurgent(unsigned int t); 162Bool isurgent(unsigned int t);
163Bool isvisible(Client *c); 163Bool isvisible(Client *c, Bool *cmp);
164void keypress(XEvent *e); 164void keypress(XEvent *e);
165void killclient(const char *arg); 165void killclient(const char *arg);
166void manage(Window w, XWindowAttributes *wa); 166void manage(Window w, XWindowAttributes *wa);
@@ -287,7 +287,7 @@ arrange(void) {
287 Client *c; 287 Client *c;
288 288
289 for(c = clients; c; c = c->next) 289 for(c = clients; c; c = c->next)
290 if(isvisible(c)) { 290 if(isvisible(c, NULL)) {
291 unban(c); 291 unban(c);
292 if(lt->isfloating || c->isfloating) 292 if(lt->isfloating || c->isfloating)
293 resize(c, c->fx, c->fy, c->fw, c->fh, True); 293 resize(c, c->fx, c->fy, c->fw, c->fh, True);
@@ -469,7 +469,7 @@ configurerequest(XEvent *e) {
469 if((ev->value_mask & (CWX|CWY)) 469 if((ev->value_mask & (CWX|CWY))
470 && !(ev->value_mask & (CWWidth|CWHeight))) 470 && !(ev->value_mask & (CWWidth|CWHeight)))
471 configure(c); 471 configure(c);
472 if(isvisible(c)) 472 if(isvisible(c, NULL))
473 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 473 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
474 } 474 }
475 else 475 else
@@ -536,7 +536,7 @@ drawbar(void) {
536 drawtext(geom->symbol, dc.norm, False); 536 drawtext(geom->symbol, dc.norm, False);
537 dc.x += bgw; 537 dc.x += bgw;
538 } 538 }
539 for(c = stack; c && !isvisible(c); c = c->snext); 539 for(c = stack; c && !isvisible(c, NULL); c = c->snext);
540 for(i = 0; i < LENGTH(tags); i++) { 540 for(i = 0; i < LENGTH(tags); i++) {
541 dc.w = textw(tags[i]); 541 dc.w = textw(tags[i]);
542 if(tagset[seltags][i]) { 542 if(tagset[seltags][i]) {
@@ -676,8 +676,8 @@ expose(XEvent *e) {
676 676
677void 677void
678focus(Client *c) { 678focus(Client *c) {
679 if(!c || (c && !isvisible(c))) 679 if(!c || (c && !isvisible(c, NULL)))
680 for(c = stack; c && !isvisible(c); c = c->snext); 680 for(c = stack; c && !isvisible(c, NULL); c = c->snext);
681 if(sel && sel != c) { 681 if(sel && sel != c) {
682 grabbuttons(sel, False); 682 grabbuttons(sel, False);
683 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); 683 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@@ -711,9 +711,9 @@ focusnext(const char *arg) {
711 711
712 if(!sel) 712 if(!sel)
713 return; 713 return;
714 for(c = sel->next; c && !isvisible(c); c = c->next); 714 for(c = sel->next; c && !isvisible(c, arg ? sel->tags : NULL); c = c->next);
715 if(!c) 715 if(!c)
716 for(c = clients; c && !isvisible(c); c = c->next); 716 for(c = clients; c && !isvisible(c, arg ? sel->tags : NULL); c = c->next);
717 if(c) { 717 if(c) {
718 focus(c); 718 focus(c);
719 restack(); 719 restack();
@@ -726,10 +726,10 @@ focusprev(const char *arg) {
726 726
727 if(!sel) 727 if(!sel)
728 return; 728 return;
729 for(c = sel->prev; c && !isvisible(c); c = c->prev); 729 for(c = sel->prev; c && !isvisible(c, arg ? sel->tags : NULL); c = c->prev);
730 if(!c) { 730 if(!c) {
731 for(c = clients; c && c->next; c = c->next); 731 for(c = clients; c && c->next; c = c->next);
732 for(; c && !isvisible(c); c = c->prev); 732 for(; c && !isvisible(c, arg ? sel->tags : NULL); c = c->prev);
733 } 733 }
734 if(c) { 734 if(c) {
735 focus(c); 735 focus(c);
@@ -930,11 +930,13 @@ isurgent(unsigned int t) {
930} 930}
931 931
932Bool 932Bool
933isvisible(Client *c) { 933isvisible(Client *c, Bool *cmp) {
934 unsigned int i; 934 unsigned int i;
935 935
936 if(!cmp)
937 cmp = tagset[seltags];
936 for(i = 0; i < LENGTH(tags); i++) 938 for(i = 0; i < LENGTH(tags); i++)
937 if(c->tags[i] && tagset[seltags][i]) 939 if(c->tags[i] && cmp[i])
938 return True; 940 return True;
939 return False; 941 return False;
940} 942}
@@ -1061,7 +1063,7 @@ monocle(void) {
1061 Client *c; 1063 Client *c;
1062 1064
1063 for(c = clients; c; c = c->next) 1065 for(c = clients; c; c = c->next)
1064 if((lt->isfloating || !c->isfloating) && isvisible(c)) 1066 if((lt->isfloating || !c->isfloating) && isvisible(c, NULL))
1065 resize(c, mox, moy, mow - 2 * c->bw, moh - 2 * c->bw, RESIZEHINTS); 1067 resize(c, mox, moy, mow - 2 * c->bw, moh - 2 * c->bw, RESIZEHINTS);
1066} 1068}
1067 1069
@@ -1115,7 +1117,7 @@ movemouse(Client *c) {
1115 1117
1116Client * 1118Client *
1117nexttiled(Client *c) { 1119nexttiled(Client *c) {
1118 for(; c && (c->isfloating || !isvisible(c)); c = c->next); 1120 for(; c && (c->isfloating || !isvisible(c, NULL)); c = c->next);
1119 return c; 1121 return c;
1120} 1122}
1121 1123
@@ -1292,7 +1294,7 @@ restack(void) {
1292 wc.stack_mode = Below; 1294 wc.stack_mode = Below;
1293 wc.sibling = barwin; 1295 wc.sibling = barwin;
1294 for(c = stack; c; c = c->snext) 1296 for(c = stack; c; c = c->snext)
1295 if(!c->isfloating && isvisible(c)) { 1297 if(!c->isfloating && isvisible(c, NULL)) {
1296 XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); 1298 XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
1297 wc.sibling = c->win; 1299 wc.sibling = c->win;
1298 } 1300 }