Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-attachbelow-toggleable-6.2.diff - sites - public wiki contents of suckless.…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-attachbelow-toggleable-6.2.diff (6046B)
---
1 From ee036687ed9e1bb973b9e34694a57cf5dd67652d Mon Sep 17 00:00:00 2001
2 From: Jonathan Hodgson <[email protected]>
3 Date: Mon, 6 May 2019 18:34:40 +0100
4 Subject: [PATCH 1/4] Adds attach below option
5
6 ---
7 config.def.h | 1 +
8 dwm.c | 31 ++++++++++++++++++++++++++++---
9 2 files changed, 29 insertions(+), 3 deletions(-)
10
11 diff --git a/config.def.h b/config.def.h
12 index 1c0b587..51ad933 100644
13 --- a/config.def.h
14 +++ b/config.def.h
15 @@ -35,6 +35,7 @@ static const Rule rules[] = {
16 static const float mfact = 0.55; /* factor of master area size [0.0…
17 static const int nmaster = 1; /* number of clients in master are…
18 static const int resizehints = 1; /* 1 means respect size hints in t…
19 +static const int attachbelow = 1; /* 1 means attach at the end */
20
21 static const Layout layouts[] = {
22 /* symbol arrange function */
23 diff --git a/dwm.c b/dwm.c
24 index 4465af1..bd715a2 100644
25 --- a/dwm.c
26 +++ b/dwm.c
27 @@ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y,…
28 static void arrange(Monitor *m);
29 static void arrangemon(Monitor *m);
30 static void attach(Client *c);
31 +static void attachBelow(Client *c);
32 static void attachstack(Client *c);
33 static void buttonpress(XEvent *e);
34 static void checkotherwm(void);
35 @@ -405,6 +406,21 @@ attach(Client *c)
36 c->next = c->mon->clients;
37 c->mon->clients = c;
38 }
39 +void
40 +attachBelow(Client *c)
41 +{
42 + //If there is nothing on the monitor or the selected client is …
43 + if(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfl…
44 + attach(c);
45 + return;
46 + }
47 +
48 + //Set the new client's next property to the same as the current…
49 + c->next = c->mon->sel->next;
50 + //Set the currently selected clients next property to the new c…
51 + c->mon->sel->next = c;
52 +
53 +}
54
55 void
56 attachstack(Client *c)
57 @@ -1062,7 +1078,10 @@ manage(Window w, XWindowAttributes *wa)
58 c->isfloating = c->oldstate = trans != None || c->isfix…
59 if (c->isfloating)
60 XRaiseWindow(dpy, c->win);
61 - attach(c);
62 + if( attachbelow )
63 + attachBelow(c);
64 + else
65 + attach(c);
66 attachstack(c);
67 XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 3…
68 (unsigned char *) &(c->win), 1);
69 @@ -1417,7 +1436,10 @@ sendmon(Client *c, Monitor *m)
70 detachstack(c);
71 c->mon = m;
72 c->tags = m->tagset[m->seltags]; /* assign tags of target monit…
73 - attach(c);
74 + if( attachbelow )
75 + attachBelow(c);
76 + else
77 + attach(c);
78 attachstack(c);
79 focus(NULL);
80 arrange(NULL);
81 @@ -1897,7 +1919,10 @@ updategeom(void)
82 m->clients = c->next;
83 detachstack(c);
84 c->mon = mons;
85 - attach(c);
86 + if( attachbelow )
87 + attachBelow(c);
88 + else
89 + attach(c);
90 attachstack(c);
91 }
92 if (m == selmon)
93 --
94 2.21.0
95
96
97 From e212c1d8cbdcc56c33c717131dfa7c1689e27e9f Mon Sep 17 00:00:00 2001
98 From: Jonathan Hodgson <[email protected]>
99 Date: Mon, 6 May 2019 19:27:57 +0100
100 Subject: [PATCH 2/4] fixes comment
101
102 ---
103 config.def.h | 2 +-
104 1 file changed, 1 insertion(+), 1 deletion(-)
105
106 diff --git a/config.def.h b/config.def.h
107 index 51ad933..cb8053a 100644
108 --- a/config.def.h
109 +++ b/config.def.h
110 @@ -35,7 +35,7 @@ static const Rule rules[] = {
111 static const float mfact = 0.55; /* factor of master area size [0.0…
112 static const int nmaster = 1; /* number of clients in master are…
113 static const int resizehints = 1; /* 1 means respect size hints in t…
114 -static const int attachbelow = 1; /* 1 means attach at the end */
115 +static const int attachbelow = 1; /* 1 means attach after the curren…
116
117 static const Layout layouts[] = {
118 /* symbol arrange function */
119 --
120 2.21.0
121
122
123 From 7568ea3f8756e7e82b30c4943556ae646a445d1c Mon Sep 17 00:00:00 2001
124 From: Jonathan Hodgson <[email protected]>
125 Date: Mon, 6 May 2019 20:00:30 +0100
126 Subject: [PATCH 3/4] Makes changes to man page to reflect attach below p…
127
128 ---
129 dwm.1 | 3 +++
130 1 file changed, 3 insertions(+)
131
132 diff --git a/dwm.1 b/dwm.1
133 index 13b3729..fb6e76c 100644
134 --- a/dwm.1
135 +++ b/dwm.1
136 @@ -29,6 +29,9 @@ color. The tags of the focused window are indicated wi…
137 top left corner. The tags which are applied to one or more windows are
138 indicated with an empty square in the top left corner.
139 .P
140 +The attach below patch makes newly spawned windows attach after the cur…
141 +selected window
142 +.P
143 dwm draws a small border around windows to indicate the focus state.
144 .SH OPTIONS
145 .TP
146 --
147 2.21.0
148
149
150 From 362b95a5b9f91673f27f3e3343b5738df3c9d6e9 Mon Sep 17 00:00:00 2001
151 From: Jonathan Hodgson <[email protected]>
152 Date: Sun, 2 Jun 2019 15:11:57 +0100
153 Subject: [PATCH 4/4] Allows attach below to be toggled
154
155 ---
156 config.def.h | 2 +-
157 dwm.c | 6 ++++++
158 2 files changed, 7 insertions(+), 1 deletion(-)
159
160 diff --git a/config.def.h b/config.def.h
161 index cb8053a..b4d35aa 100644
162 --- a/config.def.h
163 +++ b/config.def.h
164 @@ -35,7 +35,7 @@ static const Rule rules[] = {
165 static const float mfact = 0.55; /* factor of master area size [0.0…
166 static const int nmaster = 1; /* number of clients in master are…
167 static const int resizehints = 1; /* 1 means respect size hints in t…
168 -static const int attachbelow = 1; /* 1 means attach after the curren…
169 +static int attachbelow = 1; /* 1 means attach after the currently ac…
170
171 static const Layout layouts[] = {
172 /* symbol arrange function */
173 diff --git a/dwm.c b/dwm.c
174 index bd715a2..5d88653 100644
175 --- a/dwm.c
176 +++ b/dwm.c
177 @@ -148,6 +148,7 @@ static void arrange(Monitor *m);
178 static void arrangemon(Monitor *m);
179 static void attach(Client *c);
180 static void attachBelow(Client *c);
181 +static void toggleAttachBelow();
182 static void attachstack(Client *c);
183 static void buttonpress(XEvent *e);
184 static void checkotherwm(void);
185 @@ -422,6 +423,11 @@ attachBelow(Client *c)
186
187 }
188
189 +void toggleAttachBelow()
190 +{
191 + attachbelow = !attachbelow;
192 +}
193 +
194 void
195 attachstack(Client *c)
196 {
197 --
198 2.21.0
199
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.