summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-09-06 23:25:32 +0200
committerbakkeby <[email protected]>2019-09-06 23:25:32 +0200
commit04a7b4de407480089e575b0047d6998ccc001791 (patch)
tree02fd846ce5245e81319f13bf80d7264dd324ef59 /patch
parentab6eb606576a6fa966145b2066e7e59e6e7903a0 (diff)
downloaddwm-flexipatch-04a7b4de407480089e575b0047d6998ccc001791.tar.gz
dwm-flexipatch-04a7b4de407480089e575b0047d6998ccc001791.zip
Adding attachabove, attachaside, attachbelow and attachbottom patches
Diffstat (limited to 'patch')
-rw-r--r--patch/attachx.c41
-rw-r--r--patch/attachx.h1
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
4 files changed, 50 insertions, 0 deletions
diff --git a/patch/attachx.c b/patch/attachx.c
new file mode 100644
index 0000000..1557510
--- /dev/null
+++ b/patch/attachx.c
@@ -0,0 +1,41 @@
+void
+attachx(Client *c)
+{
+ #if ATTACHABOVE_PATCH
+ Client *at;
+ if (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) {
+ for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
+ c->next = at->next;
+ at->next = c;
+ return;
+ }
+ #elif ATTACHASIDE_PATCH
+ Client *at;
+ unsigned int n;
+
+ for (at = c->mon->clients, n = 0; at; at = at->next)
+ if (!at->isfloating && ISVISIBLEONTAG(at, c->tags))
+ if (++n >= c->mon->nmaster)
+ break;
+
+ if (at && c->mon->nmaster) {
+ c->next = at->next;
+ at->next = c;
+ return;
+ }
+ #elif ATTACHBELOW_PATCH
+ if (!(c->mon->sel == NULL || c->mon->sel->isfloating)) {
+ c->next = c->mon->sel->next;
+ c->mon->sel->next = c;
+ return;
+ }
+ #elif ATTACHBOTTOM_PATCH
+ Client *at;
+ for (at = c->mon->clients; at && at->next; at = at->next);
+ if (at) {
+ at->next = c;
+ return;
+ }
+ #endif
+ attach(c); // master (default)
+} \ No newline at end of file
diff --git a/patch/attachx.h b/patch/attachx.h
new file mode 100644
index 0000000..46a8c39
--- /dev/null
+++ b/patch/attachx.h
@@ -0,0 +1 @@
+static void attachx(Client *c); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index 6308352..ebf5e3c 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -2,6 +2,10 @@
#include "alpha.c"
#endif
+#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
+#include "attachx.c"
+#endif
+
#if PERTAG_PATCH
#include "pertag.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index a0e7a4b..29785e1 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -2,6 +2,10 @@
#include "alpha.h"
#endif
+#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
+#include "attachx.h"
+#endif
+
#if SYSTRAY_PATCH
#include "systray.h"
#endif