[wiki] [sites] Add insets patch || jD91mZM2

From: <git_AT_suckless.org>
Date: Sun, 31 May 2020 22:18:52 +0200

commit d64fe0c92a1a09242af8774b8b89f260437e79f0
Author: jD91mZM2 <me_AT_krake.one>
Date: Sun May 31 22:17:00 2020 +0200

    Add insets patch
    
    Sorry if there already exists something like this, or if I'm doing it the wrong way. This is my first submission :)

diff --git a/dwm.suckless.org/patches/insets/dwm-insets-6.2.diff b/dwm.suckless.org/patches/insets/dwm-insets-6.2.diff
new file mode 100644
index 00000000..820a65a1
--- /dev/null
+++ b/dwm.suckless.org/patches/insets/dwm-insets-6.2.diff
_AT_@ -0,0 +1,112 @@
+From c74af17bcab18263ea565e6760728d03987359a7 Mon Sep 17 00:00:00 2001
+From: jD91mZM2 <me_AT_krake.one>
+Date: Sun, 31 May 2020 22:06:00 +0200
+Subject: [PATCH] Custom screen insets
+
+---
+ config.def.h | 7 +++++++
+ dwm.c | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 42 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..43b464a 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -18,6 +18,13 @@ static const char *colors[][3] = {
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ };
+
++static const Inset default_inset = {
++ .x = 0,
++ .y = 30,
++ .w = 0,
++ .h = 0,
++};
++
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+
+diff --git a/dwm.c b/dwm.c
+index 4465af1..f91da15 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -111,6 +111,13 @@ typedef struct {
+ void (*arrange)(Monitor *);
+ } Layout;
+
++typedef struct {
++ int x;
++ int y;
++ int w;
++ int h;
++} Inset;
++
+ struct Monitor {
+ char ltsymbol[16];
+ float mfact;
+_AT_@ -130,6 +137,7 @@ struct Monitor {
+ Monitor *next;
+ Window barwin;
+ const Layout *lt[2];
++ Inset inset;
+ };
+
+ typedef struct {
+_AT_@ -199,6 +207,8 @@ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setinset(Monitor *m, Inset inset);
++static void updateinset(const Arg *arg);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+_AT_@ -641,6 +651,7 @@ createmon(void)
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
++ m->inset = default_inset;
+ return m;
+ }
+
+_AT_@ -1497,6 +1508,23 @@ setfullscreen(Client *c, int fullscreen)
+ }
+ }
+
++void
++setinset(Monitor *m, Inset inset)
++{
++ m->inset = inset;
++ updatebarpos(m);
++ arrange(m);
++}
++
++void
++updateinset(const Arg *arg)
++{
++ Inset *inset = (Inset *)arg->v;
++
++ for (Monitor *m = mons; m; m = m->next)
++ setinset(m, *inset);
++}
++
+ void
+ setlayout(const Arg *arg)
+ {
+_AT_@ -1831,6 +1859,13 @@ updatebarpos(Monitor *m)
+ m->wy = m->topbar ? m->wy + bh : m->wy;
+ } else
+ m->by = -bh;
++
++ // Custom insets
++ Inset inset = m->inset;
++ m->wx += inset.x;
++ m->wy += inset.y;
++ m->ww -= inset.w + inset.x;
++ m->wh -= inset.h + inset.y;
+ }
+
+ void
+--
+2.26.2
+
diff --git a/dwm.suckless.org/patches/insets/index.md b/dwm.suckless.org/patches/insets/index.md
new file mode 100644
index 00000000..ec45d813
--- /dev/null
+++ b/dwm.suckless.org/patches/insets/index.md
_AT_@ -0,0 +1,15 @@
+insets
+=============
+
+Description
+-----------
+This simple patch lets you define custom insets from each edge of the
+screen. It could be used to put DWM out of the way for a bar, for example.
+
+Download
+--------
+* [dwm-insets-6.2.diff](dwm-insets-6.2.diff)
+
+Authors
+-------
+* jD91mZM2 - <me_AT_krake.one>
Received on Sun May 31 2020 - 22:18:52 CEST

This archive was generated by hypermail 2.3.0 : Sun May 31 2020 - 22:24:42 CEST