[wiki] [sites] [dwm][patches][float-border-color] Normal border color is set when the client loses focus || Gabriel A. López López

From: <git_AT_suckless.org>
Date: Mon, 09 Oct 2023 04:52:56 +0200

commit 3d8753cc0a0b5936655779985f2eb17615a986c4
Author: Gabriel A. López López <glpz_AT_daxslab.com>
Date: Sun Oct 8 22:51:36 2023 -0400

    [dwm][patches][float-border-color] Normal border color is set when the client loses focus

diff --git a/dwm.suckless.org/patches/float_border_color/dwm-float-border-color-20231008-3a7ea45f.diff b/dwm.suckless.org/patches/float_border_color/dwm-float-border-color-20231008-3a7ea45f.diff
new file mode 100644
index 00000000..e279f3af
--- /dev/null
+++ b/dwm.suckless.org/patches/float_border_color/dwm-float-border-color-20231008-3a7ea45f.diff
_AT_@ -0,0 +1,109 @@
+From 5f6716fa3fb7e28e6592872ce3de32b7aa0965a7 Mon Sep 17 00:00:00 2001
+From: glpzzz <glpz_AT_daxslab.com>
+Date: Sun, 8 Oct 2023 16:44:37 -0400
+Subject: [PATCH] set the custom colored floating border on unfocus too.
+
+---
+ config.def.h | 8 ++++----
+ dwm.c | 24 ++++++++++++++++++++----
+ 2 files changed, 24 insertions(+), 8 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..ce68d1e 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -12,10 +12,10 @@ static const char col_gray2[] = "#444444";
+ static const char col_gray3[] = "#bbbbbb";
+ static const char col_gray4[] = "#eeeeee";
+ static const char col_cyan[] = "#005577";
+-static const char *colors[][3] = {
+- /* fg bg border */
+- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
++static const char *colors[][4] = {
++ /* fg bg border float */
++ [SchemeNorm] = { col_gray3, col_gray1, col_gray2, col_gray2 },
++ [SchemeSel] = { col_gray4, col_cyan, col_gray2, col_cyan },
+ };
+
+ /* tagging */
+diff --git a/dwm.c b/dwm.c
+index f1d86b2..4182083 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -56,6 +56,7 @@
+ #define HEIGHT(X) ((X)->h + 2 * (X)->bw)
+ #define TAGMASK ((1 << LENGTH(tags)) - 1)
+ #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
++#define ColFloat 3
+
+ /* enums */
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+_AT_@ -801,7 +802,10 @@ focus(Client *c)
+ detachstack(c);
+ attachstack(c);
+ grabbuttons(c, 1);
+- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
++ if(c->isfloating)
++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel);
++ else
++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
+ setfocus(c);
+ } else {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+_AT_@ -1063,7 +1067,10 @@ manage(Window w, XWindowAttributes *wa)
+
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+- XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
++ if(c->isfloating)
++ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel);
++ else
++ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
+ configure(c); /* propagates border_width, if size doesn't change */
+ updatewindowtype(c);
+ updatesizehints(c);
+_AT_@ -1074,6 +1081,8 @@ manage(Window w, XWindowAttributes *wa)
+ c->isfloating = c->oldstate = trans != None || c->isfixed;
+ if (c->isfloating)
+ XRaiseWindow(dpy, c->win);
++ if(c->isfloating)
++ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColFloat].pixel);
+ attach(c);
+ attachstack(c);
+ XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
+_AT_@ -1586,7 +1595,7 @@ setup(void)
+ /* init appearance */
+ scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
+ for (i = 0; i < LENGTH(colors); i++)
+- scheme[i] = drw_scm_create(drw, colors[i], 3);
++ scheme[i] = drw_scm_create(drw, colors[i], 4);
+ /* init bars */
+ updatebars();
+ updatestatus();
+_AT_@ -1730,6 +1739,10 @@ togglefloating(const Arg *arg)
+ return;
+ selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
+ if (selmon->sel->isfloating)
++ XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColFloat].pixel);
++ else
++ XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel);
++ if(selmon->sel->isfloating)
+ resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+ selmon->sel->w, selmon->sel->h, 0);
+ arrange(selmon);
+_AT_@ -1768,7 +1781,10 @@ unfocus(Client *c, int setfocus)
+ if (!c)
+ return;
+ grabbuttons(c, 0);
+- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
++ if (c->isfloating)
++ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColFloat].pixel);
++ else
++ XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
+ if (setfocus) {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+--
+2.39.2
+
diff --git a/dwm.suckless.org/patches/float_border_color/index.md b/dwm.suckless.org/patches/float_border_color/index.md
index 93b2558f..1da19f58 100644
--- a/dwm.suckless.org/patches/float_border_color/index.md
+++ b/dwm.suckless.org/patches/float_border_color/index.md
_AT_@ -7,6 +7,7 @@ This patch allows you to specify a different border color for floating windows.
 
 Download
 --------
+* [dwm-float-border-color-20231008-3a7ea45f.diff](dwm-float-border-color-20231008-3a7ea45f.diff) (08/10/2023)
 * [dwm-float-border-color-6.2.diff](dwm-float-border-color-6.2.diff) (14/06/2020)
 * [dwm-float\_border\_color2-20160731-56a31dc.diff](dwm-float_border_color2-20160731-56a31dc.diff)
 * [dwm-float\_border\_color-6.1.diff](dwm-float_border_color-6.1.diff) (Unclean patch)
_AT_@ -14,6 +15,7 @@ Download
 
 Author
 ------
+* Updated by Gabriel Alejandro López Lopez (glpz at daxslab.com): it sets the border color in the normal color scheme when the client loses the focus.
 * Updated for 6.2 by MLquest8 (miskuzius at gmail.com)
 * Message-ID: <20070626093131.GA5005_AT_shota.mine.nu>
 * Updated by Jan Christoph Ebersbach - <jceb_AT_e-jc.de>
Received on Mon Oct 09 2023 - 04:52:56 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 09 2023 - 05:00:52 CEST