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
|
diff --git a/dwm.c b/dwm.c
index 4465af1..49e63f0 100644
--- a/dwm.c
+++ b/dwm.c
@@ -185,7 +185,10 @@ static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
static void pop(Client *);
+static Client *prevtiled(Client *c);
static void propertynotify(XEvent *e);
+static void pushdown(const Arg *arg);
+static void pushup(const Arg *arg);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
static void resize(Client *c, int x, int y, int w, int h, int interact);
@@ -1208,6 +1211,16 @@ pop(Client *c)
arrange(c->mon);
}
+Client *
+prevtiled(Client *c) {
+ Client *p, *r;
+
+ for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
+ if(!p->isfloating && ISVISIBLE(p))
+ r = p;
+ return r;
+}
+
void
propertynotify(XEvent *e)
{
@@ -1245,6 +1258,37 @@ propertynotify(XEvent *e)
}
}
+void
+pushdown(const Arg *arg) {
+ Client *sel = selmon->sel, *c;
+
+ if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
+ return;
+ if((c = nexttiled(sel->next))) {
+ detach(sel);
+ sel->next = c->next;
+ c->next = sel;
+ }
+ focus(sel);
+ arrange(selmon);
+}
+
+void
+pushup(const Arg *arg) {
+ Client *sel = selmon->sel, *c;
+
+ if(!sel || sel->isfloating)
+ return;
+ if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
+ detach(sel);
+ sel->next = c;
+ for(c = selmon->clients; c->next != sel->next; c = c->next);
+ c->next = sel;
+ }
+ focus(sel);
+ arrange(selmon);
+}
+
void
quit(const Arg *arg)
{
|