[wiki] [sites] Add a patch for customising the border per window. || Jasper Shovelton

From: <git_AT_suckless.org>
Date: Tue, 26 Dec 2023 14:21:04 +0100

commit f93bd00e057fb4039d25bc2229cd3fb743eecd03
Author: Jasper Shovelton <Beanie.github_AT_proton.me>
Date: Tue Dec 26 13:12:19 2023 +0000

    Add a patch for customising the border per window.

diff --git a/dwm.suckless.org/patches/borderrule/dwm-borderrule-20231226-e7f651b.diff b/dwm.suckless.org/patches/borderrule/dwm-borderrule-20231226-e7f651b.diff
new file mode 100644
index 00000000..7ce41977
--- /dev/null
+++ b/dwm.suckless.org/patches/borderrule/dwm-borderrule-20231226-e7f651b.diff
_AT_@ -0,0 +1,67 @@
+From e7f651b1321747fb92521522f0aa07a01160d4af Mon Sep 17 00:00:00 2001
+From: Jasper Shovelton <Beanie.github_AT_proton.me>
+Date: Tue, 26 Dec 2023 12:57:35 +0000
+Subject: [PATCH] Add a `borderpx` value to `rules` in `config.def.h`.
+
+---
+ config.def.h | 6 +++---
+ dwm.c | 5 ++++-
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..bdddfa5 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -26,9 +26,9 @@ static const Rule rules[] = {
+ * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title
+ */
+- /* class instance title tags mask isfloating monitor */
+- { "Gimp", NULL, NULL, 0, 1, -1 },
+- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
++ /* class instance title tags mask isfloating monitor border width */
++ { "Gimp", NULL, NULL, 0, 1, -1, -1 },
++ { "Firefox", NULL, NULL, 1 << 8, 0, -1, 0 },
+ };
+
+ /* layout(s) */
+diff --git a/dwm.c b/dwm.c
+index f1d86b2..48403c2 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -139,6 +139,7 @@ typedef struct {
+ unsigned int tags;
+ int isfloating;
+ int monitor;
++ int bw;
+ } Rule;
+
+ /* function declarations */
+_AT_@ -287,6 +288,7 @@ applyrules(Client *c)
+ /* rule matching */
+ c->isfloating = 0;
+ c->tags = 0;
++ c->bw = borderpx;
+ XGetClassHint(dpy, c->win, &ch);
+ class = ch.res_class ? ch.res_class : broken;
+ instance = ch.res_name ? ch.res_name : broken;
+_AT_@ -299,6 +301,8 @@ applyrules(Client *c)
+ {
+ c->isfloating = r->isfloating;
+ c->tags |= r->tags;
++ if (r->bw != -1)
++ c->bw = r->bw;
+ for (m = mons; m && m->num != r->monitor; m = m->next);
+ if (m)
+ c->mon = m;
+_AT_@ -1059,7 +1063,6 @@ manage(Window w, XWindowAttributes *wa)
+ c->y = c->mon->wy + c->mon->wh - HEIGHT(c);
+ c->x = MAX(c->x, c->mon->wx);
+ c->y = MAX(c->y, c->mon->wy);
+- c->bw = borderpx;
+
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+--
+2.43.0
+
diff --git a/dwm.suckless.org/patches/borderrule/index.md b/dwm.suckless.org/patches/borderrule/index.md
new file mode 100644
index 00000000..049583c4
--- /dev/null
+++ b/dwm.suckless.org/patches/borderrule/index.md
_AT_@ -0,0 +1,14 @@
+borderrule
+=========
+
+Description
+-----------
+This patch extends `rules` to include customising the border width. Set it to `-1` to use the value of `borderpx`.
+
+Download
+--------
+* [dwm-borderrule-20231226-e7f651b.diff](dwm-borderrule-20231226-e7f651b.diff)
+
+Authors
+-------
+* Jasper Shovelton - <jaspershovelton_AT_proton.me>
Received on Tue Dec 26 2023 - 14:21:04 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 26 2023 - 14:24:47 CET