about summary refs log tree commit diff stats
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
parentb848f4bda8861115c04aecd9fd87baf928d931de (diff)
downloaddwm-5602f44b29b5c9a9b66b012b34f5749929c5cd31.tar.gz
implemented exact focus next, if arg != NULL to focus{next,prev}
-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[] = {
 		"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
 	{ MODKEY|ShiftMask,		XK_Return,	spawn,		"exec uxterm" },
 	{ MODKEY,			XK_j,		focusnext,	NULL },
+	{ MODKEY|ShiftMask,		XK_j,		focusnext,	"exact" },
 	{ MODKEY,			XK_k,		focusprev,	NULL },
+	{ MODKEY|ShiftMask,		XK_k,		focusprev,	"exact" },
 	{ MODKEY,			XK_r,		reapply,	NULL },
 	{ MODKEY,			XK_h,		setmfact,	"-0.05" },
 	{ 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
 # flags
 CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
 LDFLAGS = -s ${LIBS}
-#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
-#LDFLAGS = -g ${LIBS}
+CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
+LDFLAGS = -g ${LIBS}
 
 # Solaris
 #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.
 .B Mod1\-j
 Focus next window.
 .TP
+.B Mod1\-Shift\-j
+Focus next window with exactly the same tags as the current one.
+.TP
 .B Mod1\-k
 Focus previous window.
 .TP
+.B Mod1\-Shift\-k
+Focus previous window with exactly the same tags as the current one.
+.TP
 .B Mod1\-h
 Decrease master area size.
 .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);
 Bool isoccupied(unsigned int t);
 Bool isprotodel(Client *c);
 Bool isurgent(unsigned int t);
-Bool isvisible(Client *c);
+Bool isvisible(Client *c, Bool *cmp);
 void keypress(XEvent *e);
 void killclient(const char *arg);
 void manage(Window w, XWindowAttributes *wa);
@@ -287,7 +287,7 @@ arrange(void) {
 	Client *c;
 
 	for(c = clients; c; c = c->next)
-		if(isvisible(c)) {
+		if(isvisible(c, NULL)) {
 			unban(c);
 			if(lt->isfloating || c->isfloating)
 				resize(c, c->fx, c->fy, c->fw, c->fh, True);
@@ -469,7 +469,7 @@ configurerequest(XEvent *e) {
 			if((ev->value_mask & (CWX|CWY))
 			&& !(ev->value_mask & (CWWidth|CWHeight)))
 				configure(c);
-			if(isvisible(c))
+			if(isvisible(c, NULL))
 				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
 		}
 		else
@@ -536,7 +536,7 @@ drawbar(void) {
 		drawtext(geom->symbol, dc.norm, False);
 		dc.x += bgw;
 	}
-	for(c = stack; c && !isvisible(c); c = c->snext);
+	for(c = stack; c && !isvisible(c, NULL); c = c->snext);
 	for(i = 0; i < LENGTH(tags); i++) {
 		dc.w = textw(tags[i]);
 		if(tagset[seltags][i]) {
@@ -676,8 +676,8 @@ expose(XEvent *e) {
 
 void
 focus(Client *c) {
-	if(!c || (c && !isvisible(c)))
-		for(c = stack; c && !isvisible(c); c = c->snext);
+	if(!c || (c && !isvisible(c, NULL)))
+		for(c = stack; c && !isvisible(c, NULL); c = c->snext);
 	if(sel && sel != c) {
 		grabbuttons(sel, False);
 		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@@ -711,9 +711,9 @@ focusnext(const char *arg) {
 
 	if(!sel)
 		return;
-	for(c = sel->next; c && !isvisible(c); c = c->next);
+	for(c = sel->next; c && !isvisible(c, arg ? sel->tags : NULL); c = c->next);
 	if(!c)
-		for(c = clients; c && !isvisible(c); c = c->next);
+		for(c = clients; c && !isvisible(c, arg ? sel->tags : NULL); c = c->next);
 	if(c) {
 		focus(c);
 		restack();
@@ -726,10 +726,10 @@ focusprev(const char *arg) {
 
 	if(!sel)
 		return;
-	for(c = sel->prev; c && !isvisible(c); c = c->prev);
+	for(c = sel->prev; c && !isvisible(c, arg ? sel->tags : NULL); c = c->prev);
 	if(!c) {
 		for(c = clients; c && c->next; c = c->next);
-		for(; c && !isvisible(c); c = c->prev);
+		for(; c && !isvisible(c, arg ? sel->tags : NULL); c = c->prev);
 	}
 	if(c) {
 		focus(c);
@@ -930,11 +930,13 @@ isurgent(unsigned int t) {
 }
 
 Bool
-isvisible(Client *c) {
+isvisible(Client *c, Bool *cmp) {
 	unsigned int i;
 
+	if(!cmp)
+		cmp = tagset[seltags];
 	for(i = 0; i < LENGTH(tags); i++)
-		if(c->tags[i] && tagset[seltags][i])
+		if(c->tags[i] && cmp[i])
 			return True;
 	return False;
 }
@@ -1061,7 +1063,7 @@ monocle(void) {
 	Client *c;
 
 	for(c = clients; c; c = c->next)
-		if((lt->isfloating || !c->isfloating) &&  isvisible(c))
+		if((lt->isfloating || !c->isfloating) &&  isvisible(c, NULL))
 			resize(c, mox, moy, mow - 2 * c->bw, moh - 2 * c->bw, RESIZEHINTS);
 }
 
@@ -1115,7 +1117,7 @@ movemouse(Client *c) {
 
 Client *
 nexttiled(Client *c) {
-	for(; c && (c->isfloating || !isvisible(c)); c = c->next);
+	for(; c && (c->isfloating || !isvisible(c, NULL)); c = c->next);
 	return c;
 }
 
@@ -1292,7 +1294,7 @@ restack(void) {
 		wc.stack_mode = Below;
 		wc.sibling = barwin;
 		for(c = stack; c; c = c->snext)
-			if(!c->isfloating && isvisible(c)) {
+			if(!c->isfloating && isvisible(c, NULL)) {
 				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
 				wc.sibling = c->win;
 			}
<vc@akkartik.com> 2016-12-26 20:44:10 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-12-26 20:58:37 -0800 3713 - cross-link calls with definitions in html' href='/akkartik/mu/commit/html/023boolean.cc.html?h=hlt&id=201458e3bd2f1d79a0ea0b853552e9df267e92b1'>201458e3 ^
204dae92 ^

201458e3 ^
9e751bb8 ^



204dae92 ^
201458e3 ^
9e751bb8 ^

204dae92 ^

9e751bb8 ^

204dae92 ^





201458e3 ^
9e751bb8 ^
204dae92 ^





201458e3 ^
204dae92 ^






201458e3 ^
204dae92 ^




201458e3 ^
204dae92 ^




201458e3 ^
204dae92 ^






201458e3 ^
204dae92 ^

201458e3 ^
9e751bb8 ^



204dae92 ^
201458e3 ^
9e751bb8 ^

204dae92 ^

9e751bb8 ^

204dae92 ^





201458e3 ^
9e751bb8 ^
204dae92 ^





201458e3 ^
204dae92 ^






201458e3 ^
204dae92 ^




201458e3 ^
204dae92 ^




201458e3 ^
204dae92 ^






201458e3 ^
204dae92 ^

201458e3 ^
9e751bb8 ^

204dae92 ^
201458e3 ^
9e751bb8 ^



204dae92 ^
201458e3 ^
9e751bb8 ^




204dae92 ^




201458e3 ^

9e751bb8 ^
204dae92 ^




201458e3 ^
204dae92 ^





201458e3 ^
204dae92 ^




672e3e50 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233