This repository has been archived by the owner on Jan 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
dwm-6.0-zoomswap.diff
55 lines (51 loc) · 1.54 KB
/
dwm-6.0-zoomswap.diff
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
Author: Jan Christoph Ebersbach <[email protected]>
URL: http://dwm.suckless.org/patches/zoomswap
This patch swaps the current window with the previous master when zooming.
diff -r ec4baab78314 dwm.c
--- a/dwm.c Mon Dec 19 15:38:30 2011 +0100
+++ b/dwm.c Fri Apr 06 08:23:45 2012 +0200
@@ -253,6 +253,7 @@
static void zoom(const Arg *arg);
/* variables */
+static Client *prevzoom = NULL;
static const char broken[] = "broken";
static char stext[256];
static int screen;
@@ -2116,14 +2117,36 @@
void
zoom(const Arg *arg) {
Client *c = selmon->sel;
+ Client *at, *tmp;
if(!selmon->lt[selmon->sellt]->arrange
|| (selmon->sel && selmon->sel->isfloating))
return;
- if(c == nexttiled(selmon->clients))
- if(!c || !(c = nexttiled(c->next)))
- return;
+ if(c == nexttiled(selmon->clients)) {
+ for(tmp = selmon->clients; tmp && tmp != prevzoom; tmp = tmp->next) ;
+ if(tmp != prevzoom)
+ prevzoom = NULL;
+ if(!c || !(c = nexttiled(prevzoom))) {
+ c = selmon->sel;
+ if(!c || !(c = nexttiled(c->next)))
+ return;
+ }
+ }
+ for(at = selmon->clients; at && at->next && at != c && at->next != c; at = nexttiled(at->next)) ;
pop(c);
+ /* swap windows instead of pushing the previous one down */
+ if(at && at != c) {
+ /* store c's next neighbor - this window needs to be moved away */
+ tmp = prevzoom = c->next;
+ if(c->next != at) {
+ /* detach c's neighbor from the list of windows */
+ c->next = tmp->next;
+ /* attach tmp after c's previous neighbor */
+ tmp->next = at->next;
+ at->next = tmp;
+ arrange(c->mon);
+ }
+ }
}
int