[wiki] [sites] Added patch for dwm to kill unwanted windows || Kim Nielsen

From: <git_AT_suckless.org>
Date: Sun, 18 Apr 2021 15:43:18 +0200

commit 5e9542f85913e40295fb23f61983cc6c5e4ae626
Author: Kim Nielsen <kgn_AT_one.com>
Date: Sun Apr 18 15:42:35 2021 +0200

    Added patch for dwm to kill unwanted windows

diff --git a/dwm.suckless.org/patches/notallowed/dwm-notallowed-6.2.diff b/dwm.suckless.org/patches/notallowed/dwm-notallowed-6.2.diff
new file mode 100644
index 00000000..2e1363b8
--- /dev/null
+++ b/dwm.suckless.org/patches/notallowed/dwm-notallowed-6.2.diff
_AT_@ -0,0 +1,67 @@
+diff -up dwm-6.2.orig/config.def.h dwm-6.2/config.def.h
+--- dwm-6.2.orig/config.def.h 2021-04-17 17:58:27.803010601 +0200
++++ dwm-6.2/config.def.h 2021-04-18 15:17:55.254072814 +0200
+_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 notallowed */
++ { "Gimp", NULL, NULL, 0, 1, -1, 0 },
++ { "Firefox", NULL, NULL, 1 << 8, 0, -1, 0 },
+ };
+
+ /* layout(s) */
+diff -up dwm-6.2.orig/dwm.c dwm-6.2/dwm.c
+--- dwm-6.2.orig/dwm.c 2021-04-17 17:58:27.803010601 +0200
++++ dwm-6.2/dwm.c 2021-04-18 15:26:14.659767016 +0200
+_AT_@ -92,7 +92,7 @@ struct Client {
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ int bw, oldbw;
+ unsigned int tags;
+- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, notallowed;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+_AT_@ -139,6 +139,7 @@ typedef struct {
+ unsigned int tags;
+ int isfloating;
+ int monitor;
++ int notallowed;
+ } Rule;
+
+ /* function declarations */
+_AT_@ -297,6 +298,10 @@ applyrules(Client *c)
+ && (!r->class || strstr(class, r->class))
+ && (!r->instance || strstr(instance, r->instance)))
+ {
++ if (r->notallowed) {
++ c->notallowed = r->notallowed;
++ break;
++ }
+ c->isfloating = r->isfloating;
+ c->tags |= r->tags;
+ for (m = mons; m && m->num != r->monitor; m = m->next);
+_AT_@ -1029,6 +1034,7 @@ manage(Window w, XWindowAttributes *wa)
+ c->w = c->oldw = wa->width;
+ c->h = c->oldh = wa->height;
+ c->oldbw = wa->border_width;
++ c->notallowed = 0;
+
+ updatetitle(c);
+ if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
+_AT_@ -1037,6 +1043,11 @@ manage(Window w, XWindowAttributes *wa)
+ } else {
+ c->mon = selmon;
+ applyrules(c);
++ if (c->notallowed) {
++ XKillClient(dpy, c->win);
++ free(c);
++ return;
++ }
+ }
+
+ if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
diff --git a/dwm.suckless.org/patches/notallowed/index.md b/dwm.suckless.org/patches/notallowed/index.md
new file mode 100644
index 00000000..33cbf527
--- /dev/null
+++ b/dwm.suckless.org/patches/notallowed/index.md
_AT_@ -0,0 +1,14 @@
+notallowed
+=====
+
+Description
+-----------
+Extend the rules with a `notallowed` option to kill windows with a specific class, instance or title.
+
+Download
+--------
+* [dwm-notallowed-6.2.diff](dwm-notallowed-6.2.diff)
+
+Author
+-------
+* Kim Gert Nielsen - <kn_AT_insecurity.dk>
Received on Sun Apr 18 2021 - 15:43:18 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 18 2021 - 15:48:52 CEST