bakkeby/dwm-flexipatch

Feature request: _IS_FLOATING patch

B4rc1 opened this issue · 1 comments

B4rc1 commented

A patch, that adds a _IS_FLOATING xproperty for floating windows,
so you can add compositor rules accordingly, for example (with a picom fork with rounded corners) adding this to your picom.conf

rounded-corners-exclude = [ "! _IS_FLOATING@:32c = 1" ];

rounds all floating windows

patch:

diff --git a/dwm.c b/dwm.c
index 664c527..2e05488 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1075,6 +1075,10 @@ manage(Window w, XWindowAttributes *wa)
 	arrange(c->mon);
 	XMapWindow(dpy, c->win);
 	focus(NULL);
+
+	Atom target = XInternAtom(dpy, "_IS_FLOATING", 0);
+	unsigned int floating[1] = {c->isfloating};
+	XChangeProperty(dpy, c->win, target, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)floating, 1);
 }
 
 void
@@ -1720,6 +1724,10 @@ togglefloating(const Arg *arg)
 		resize(selmon->sel, selmon->sel->x, selmon->sel->y,
 			selmon->sel->w, selmon->sel->h, 0);
 	arrange(selmon);
+
+	Atom target = XInternAtom(dpy, "_IS_FLOATING", 0);
+	unsigned int floating[1] = {selmon->sel->isfloating};
+    XChangeProperty(dpy, selmon->sel->win, target, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)floating, 1);
 }
 
 v

This works nicely. I ended up embedding this with the ewmhtags patch (which I had given the bar_ prefix as it only added hints related to the bar. I may remove that prefix later on, but left it as-is for now). Thanks.