-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdwm-attachnext-6.2.diff
72 lines (68 loc) · 1.81 KB
/
dwm-attachnext-6.2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 4a952c5d35ea4b28a9bc6541ddcde50b55212f8a Mon Sep 17 00:00:00 2001
From: Hilde N <[email protected]>
Date: Sat, 23 May 2020 18:17:54 -0400
Subject: [PATCH] attach new windows next in the cycle
---
dwm.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dwm.c b/dwm.c
index 9fd0286..434c438 100644
--- a/dwm.c
+++ b/dwm.c
@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
+static void attachnext(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -407,6 +408,20 @@ attach(Client *c)
c->mon->clients = c;
}
+void
+attachnext(Client *c)
+{
+ Client *n;
+
+ for (n = nexttiled(c->mon->clients); n && n != c->mon->sel && nexttiled(n->next); n = nexttiled(n->next));
+ if (n) {
+ c->next = n->next;
+ n->next = c;
+ } else {
+ attach(c);
+ }
+}
+
void
attachstack(Client *c)
{
@@ -1063,7 +1078,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
- attach(c);
+ attachnext(c);
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
@@ -1418,7 +1433,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
- attach(c);
+ attachnext(c);
attachstack(c);
focus(NULL);
arrange(NULL);
@@ -1900,7 +1915,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachnext(c);
attachstack(c);
}
if (m == selmon)
--
2.26.2