173 XEvent ev; |
173 XEvent ev; |
174 |
174 |
175 drawstatus(); |
175 drawstatus(); |
176 if(!sel) |
176 if(!sel) |
177 return; |
177 return; |
178 if(sel->swimming || lt->arrange == swim) |
178 if(sel->versatile || lt->arrange == versatile) |
179 XRaiseWindow(dpy, sel->win); |
179 XRaiseWindow(dpy, sel->win); |
180 if(lt->arrange != swim) { |
180 if(lt->arrange != versatile) { |
181 if(!sel->swimming) |
181 if(!sel->versatile) |
182 XLowerWindow(dpy, sel->win); |
182 XLowerWindow(dpy, sel->win); |
183 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
183 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
184 if(c == sel) |
184 if(c == sel) |
185 continue; |
185 continue; |
186 XLowerWindow(dpy, c->win); |
186 XLowerWindow(dpy, c->win); |
206 snprintf(prop, sizeof prop, "%s:%s:%s", |
206 snprintf(prop, sizeof prop, "%s:%s:%s", |
207 ch.res_class ? ch.res_class : "", |
207 ch.res_class ? ch.res_class : "", |
208 ch.res_name ? ch.res_name : "", c->name); |
208 ch.res_name ? ch.res_name : "", c->name); |
209 for(i = 0; i < nrules; i++) |
209 for(i = 0; i < nrules; i++) |
210 if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { |
210 if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { |
211 c->swimming = rule[i].swimming; |
211 c->versatile = rule[i].versatile; |
212 for(j = 0; regs[i].tagregex && j < ntags; j++) { |
212 for(j = 0; regs[i].tagregex && j < ntags; j++) { |
213 if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { |
213 if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { |
214 matched = True; |
214 matched = True; |
215 c->tags[j] = True; |
215 c->tags[j] = True; |
216 } |
216 } |
225 for(i = 0; i < ntags; i++) |
225 for(i = 0; i < ntags; i++) |
226 c->tags[i] = seltag[i]; |
226 c->tags[i] = seltag[i]; |
227 } |
227 } |
228 |
228 |
229 void |
229 void |
230 swim(void) { |
|
231 Client *c; |
|
232 |
|
233 for(c = clients; c; c = c->next) { |
|
234 if(isvisible(c)) { |
|
235 if(c->isbanned) |
|
236 XMoveWindow(dpy, c->win, c->x, c->y); |
|
237 c->isbanned = False; |
|
238 resize(c, c->x, c->y, c->w, c->h, True); |
|
239 } |
|
240 else { |
|
241 c->isbanned = True; |
|
242 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
|
243 } |
|
244 } |
|
245 if(!sel || !isvisible(sel)) { |
|
246 for(c = stack; c && !isvisible(c); c = c->snext); |
|
247 focus(c); |
|
248 } |
|
249 restack(); |
|
250 } |
|
251 |
|
252 void |
|
253 tag(Arg *arg) { |
230 tag(Arg *arg) { |
254 unsigned int i; |
231 unsigned int i; |
255 |
232 |
256 if(!sel) |
233 if(!sel) |
257 return; |
234 return; |
258 for(i = 0; i < ntags; i++) |
235 for(i = 0; i < ntags; i++) |
259 sel->tags[i] = (arg->i == -1) ? True : False; |
236 sel->tags[i] = (arg->i == -1) ? True : False; |
260 if(arg->i >= 0 && arg->i < ntags) |
237 if(arg->i >= 0 && arg->i < ntags) |
261 sel->tags[arg->i] = True; |
238 sel->tags[arg->i] = True; |
262 lt->arrange(); |
|
263 } |
|
264 |
|
265 void |
|
266 toggleswimming(Arg *arg) { |
|
267 if(!sel || lt->arrange == swim) |
|
268 return; |
|
269 sel->swimming = !sel->swimming; |
|
270 lt->arrange(); |
239 lt->arrange(); |
271 } |
240 } |
272 |
241 |
273 void |
242 void |
274 toggletag(Arg *arg) { |
243 toggletag(Arg *arg) { |
308 seltag[arg->i] = True; /* cannot toggle last view */ |
285 seltag[arg->i] = True; /* cannot toggle last view */ |
309 lt->arrange(); |
286 lt->arrange(); |
310 } |
287 } |
311 |
288 |
312 void |
289 void |
|
290 versatile(void) { |
|
291 Client *c; |
|
292 |
|
293 for(c = clients; c; c = c->next) { |
|
294 if(isvisible(c)) { |
|
295 if(c->isbanned) |
|
296 XMoveWindow(dpy, c->win, c->x, c->y); |
|
297 c->isbanned = False; |
|
298 resize(c, c->x, c->y, c->w, c->h, True); |
|
299 } |
|
300 else { |
|
301 c->isbanned = True; |
|
302 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
|
303 } |
|
304 } |
|
305 if(!sel || !isvisible(sel)) { |
|
306 for(c = stack; c && !isvisible(c); c = c->snext); |
|
307 focus(c); |
|
308 } |
|
309 restack(); |
|
310 } |
|
311 |
|
312 void |
313 view(Arg *arg) { |
313 view(Arg *arg) { |
314 unsigned int i; |
314 unsigned int i; |
315 |
315 |
316 for(i = 0; i < ntags; i++) |
316 for(i = 0; i < ntags; i++) |
317 seltag[i] = (arg->i == -1) ? True : False; |
317 seltag[i] = (arg->i == -1) ? True : False; |