dwm-attachabove-20180126-db22360.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-attachabove-20180126-db22360.diff (1021B)
---
1 diff --git a/dwm.c b/dwm.c
2 index ec6a27c..40e46bf 100644
3 --- a/dwm.c
4 +++ b/dwm.c
5 @@ -407,6 +407,20 @@ attach(Client *c)
6 c->mon->clients = c;
7 }
8
9 +void
10 +attachabove(Client *c)
11 +{
12 + if(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating) {
13 + attach(c);
14 + return;
15 + }
16 +
17 + Client *at;
18 + for(at = c->mon->clients; at->next != c->mon->sel; at = at->next);
19 + c->next = at->next;
20 + at->next = c;
21 +}
22 +
23 void
24 attachstack(Client *c)
25 {
26 @@ -1204,7 +1218,7 @@ void
27 pop(Client *c)
28 {
29 detach(c);
30 - attach(c);
31 + attachabove(c);
32 focus(c);
33 arrange(c->mon);
34 }
35 @@ -1418,7 +1432,7 @@ sendmon(Client *c, Monitor *m)
36 detachstack(c);
37 c->mon = m;
38 c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
39 - attach(c);
40 + attachabove(c);
41 attachstack(c);
42 focus(NULL);
43 arrange(NULL);
44 @@ -1898,7 +1912,7 @@ updategeom(void)
45 m->clients = c->next;
46 detachstack(c);
47 c->mon = mons;
48 - attach(c);
49 + attachabove(c);
50 attachstack(c);
51 }
52 if (m == selmon)