dwm-push-20201112-61bb8b2.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-push-20201112-61bb8b2.diff (1994B) | |
--- | |
1 From b2faf234f21e61327ded730024db37bb36635e30 Mon Sep 17 00:00:00 2001 | |
2 From: Alex Cole <[email protected]> | |
3 Date: Thu, 12 Nov 2020 17:36:52 +1300 | |
4 Subject: [PATCH] Push patch added | |
5 | |
6 --- | |
7 dwm.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
8 1 file changed, 56 insertions(+) | |
9 | |
10 diff --git a/dwm.c b/dwm.c | |
11 index 664c527..039ab00 100644 | |
12 --- a/dwm.c | |
13 +++ b/dwm.c | |
14 @@ -186,7 +186,10 @@ static void motionnotify(XEvent *e); | |
15 static void movemouse(const Arg *arg); | |
16 static Client *nexttiled(Client *c); | |
17 static void pop(Client *); | |
18 +static Client *prevtiled(Client *c); | |
19 static void propertynotify(XEvent *e); | |
20 +static void pushdown(const Arg *arg); | |
21 +static void pushup(const Arg *arg); | |
22 static void quit(const Arg *arg); | |
23 static Monitor *recttomon(int x, int y, int w, int h); | |
24 static void resize(Client *c, int x, int y, int w, int h, int interact); | |
25 @@ -1209,6 +1212,16 @@ pop(Client *c) | |
26 arrange(c->mon); | |
27 } | |
28 | |
29 +Client * | |
30 +prevtiled(Client *c) { | |
31 + Client *p, *r; | |
32 + | |
33 + for(p = selmon->clients, r = NULL; p && p != c; p = p->next) | |
34 + if(!p->isfloating && ISVISIBLE(p)) | |
35 + r = p; | |
36 + return r; | |
37 +} | |
38 + | |
39 void | |
40 propertynotify(XEvent *e) | |
41 { | |
42 @@ -1246,6 +1259,49 @@ propertynotify(XEvent *e) | |
43 } | |
44 } | |
45 | |
46 +void | |
47 +pushdown(const Arg *arg) { | |
48 + Client *sel = selmon->sel, *c; | |
49 + | |
50 + if(!sel || sel->isfloating) | |
51 + return; | |
52 + if((c = nexttiled(sel->next))) { | |
53 + detach(sel); | |
54 + sel->next = c->next; | |
55 + c->next = sel; | |
56 + } else { | |
57 + detach(sel); | |
58 + attach(sel); | |
59 + } | |
60 + focus(sel); | |
61 + arrange(selmon); | |
62 +} | |
63 + | |
64 +void | |
65 +pushup(const Arg *arg) { | |
66 + Client *sel = selmon->sel, *c; | |
67 + | |
68 + if(!sel || sel->isfloating) | |
69 + return; | |
70 + if((c = prevtiled(sel))) { | |
71 + detach(sel); | |
72 + sel->next = c; | |
73 + if(selmon->clients == c) | |
74 + selmon->clients = sel; | |
75 + else { | |
76 + for(c = selmon->clients; c->next != sel->next; … | |
77 + c->next = sel; | |
78 + } | |
79 + } else { | |
80 + for(c = sel; c->next; c = c->next); | |
81 + detach(sel); | |
82 + sel->next = NULL; | |
83 + c->next = sel; | |
84 + } | |
85 + focus(sel); | |
86 + arrange(selmon); | |
87 +} | |
88 + | |
89 void | |
90 quit(const Arg *arg) | |
91 { | |
92 -- | |
93 2.29.2 | |
94 |