[wiki] [sites] [dwm][patch] setborderpx added. Allows to change borderpx at runtime || Aaron Duxler

From: <git_AT_suckless.org>
Date: Mon, 05 Aug 2019 10:58:45 +0200

commit 0b20c4f286a37b82358239553c304b08e24d4501
Author: Aaron Duxler <aaron.duxler_AT_gmail.com>
Date: Mon Aug 5 10:58:42 2019 +0200

    [dwm][patch] setborderpx added. Allows to change borderpx at runtime

diff --git a/dwm.suckless.org/patches/setborderpx/dwm-setborderpx-6.2.diff b/dwm.suckless.org/patches/setborderpx/dwm-setborderpx-6.2.diff
new file mode 100644
index 00000000..79ff410c
--- /dev/null
+++ b/dwm.suckless.org/patches/setborderpx/dwm-setborderpx-6.2.diff
_AT_@ -0,0 +1,77 @@
+diff -up a/config.def.h b/config.def.h
+--- a/config.def.h 2019-08-05 10:36:05.794959142 +0200
++++ b/config.def.h 2019-08-05 10:35:17.964735027 +0200
+_AT_@ -84,6 +84,9 @@ static Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_minus, setborderpx, {.i = -1 } },
++ { MODKEY|ShiftMask, XK_plus, setborderpx, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_numbersign, setborderpx, {.i = 0 } },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff -up a/dwm.c b/dwm.c
+--- a/dwm.c 2019-08-05 10:36:05.794959142 +0200
++++ b/dwm.c 2019-08-05 10:23:15.094328416 +0200
+_AT_@ -119,6 +119,7 @@ struct Monitor {
+ int by; /* bar geometry */
+ int mx, my, mw, mh; /* screen size */
+ int wx, wy, ww, wh; /* window area */
++ unsigned int borderpx;
+ unsigned int seltags;
+ unsigned int sellt;
+ unsigned int tagset[2];
+_AT_@ -196,6 +197,7 @@ static void run(void);
+ static void scan(void);
+ static int sendevent(Client *c, Atom proto);
+ static void sendmon(Client *c, Monitor *m);
++static void setborderpx(const Arg *arg);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
+_AT_@ -638,6 +640,7 @@ createmon(void)
+ m->nmaster = nmaster;
+ m->showbar = showbar;
+ m->topbar = topbar;
++ m->borderpx = borderpx;
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+_AT_@ -1047,7 +1050,7 @@ manage(Window w, XWindowAttributes *wa)
+ /* only fix client y-offset, if the client center might cover the bar */
+ c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
+ && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
+- c->bw = borderpx;
++ c->bw = c->mon->borderpx;
+
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+_AT_@ -1424,6 +1427,27 @@ sendmon(Client *c, Monitor *m)
+ }
+
+ void
++setborderpx(const Arg *arg)
++{
++ Client *c;
++
++ if (arg->i == 0)
++ mons->borderpx = borderpx;
++ else if (mons->borderpx + arg->i < 0)
++ mons->borderpx = 0;
++ else
++ mons->borderpx += arg->i;
++
++ for (c = mons->clients; c; c = c->next)
++ if (c->bw + arg->i < 0)
++ c->bw = mons->borderpx = 0;
++ else
++ c->bw = mons->borderpx;
++
++ arrange(selmon);
++}
++
++void
+ setclientstate(Client *c, long state)
+ {
+ long data[] = { state, None };
diff --git a/dwm.suckless.org/patches/setborderpx/index.md b/dwm.suckless.org/patches/setborderpx/index.md
new file mode 100644
index 00000000..4781de5d
--- /dev/null
+++ b/dwm.suckless.org/patches/setborderpx/index.md
_AT_@ -0,0 +1,28 @@
+setborderpx
+===========
+
+Description
+-----------
+
+This patch allows you to change border pixels at runtime.
+
+Default key bindings
+--------------------
+ Key Argument Description
+ -------------------------------------------------
+ Mod-Shift-minus +0.25 Increase borderpx
+ Mod-Shift-plusL -0.25 Decrease borderpx
+ Mod-Shift-numbersign 0.00 Reset borderpx
+
+Notes
+-----
+You might want to set resizehints in config.h to zero to get smooth animations
+when increasing or decreasing border pixels.
+
+Download
+--------
+* [dwm-setborderpx-6.2.diff](dwm-setborderpx-6.2.diff) - 05-08-2019
+
+Author
+------
+* Aaron Duxler <aaron.duxler_AT_gmail.com>
Received on Mon Aug 05 2019 - 10:58:45 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 05 2019 - 11:00:31 CEST