1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
From 5f6716fa3fb7e28e6592872ce3de32b7aa0965a7 Mon Sep 17 00:00:00 2001
From: glpzzz <glpz@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
@@ -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
@@ -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 */
@@ -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);
@@ -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);
@@ -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,
@@ -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();
@@ -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);
@@ -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
|