[wiki] [sites] [dwm] Fix onlyquitonempty patch to make it configurable || thatlittlegit

From: <git_AT_suckless.org>
Date: Sun, 29 Apr 2018 00:58:23 +0200

commit 80f73293c4150a1dfd79a627c916595e9f7a58e2
Author: thatlittlegit <personal_AT_thatlittlegit.tk>
Date: Sat Apr 28 18:56:08 2018 -0400

    [dwm] Fix onlyquitonempty patch to make it configurable

diff --git a/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ba1a2cb.diff b/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ba1a2cb.diff
new file mode 100644
index 00000000..d58611d7
--- /dev/null
+++ b/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ba1a2cb.diff
_AT_@ -0,0 +1,46 @@
+From ba1a2cbf2a04992e05f0168965043d9335b742b9 Mon Sep 17 00:00:00 2001
+From: thatlittlegit <personal_AT_thatlittlegit.tk>
+Date: Sat, 28 Apr 2018 16:51:49 -0400
+Subject: [PATCH] Don't quit if not all windows are empty
+
+---
+ config.def.h | 2 ++
+ dwm.c | 12 +++++++++++-
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/config.def.h b/config.def.h
+index a9ac303..9732b02 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -113,3 +113,5 @@ static Button buttons[] = {
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
+ };
+
++/* quitting */
++static const int EMPTY_WINDOW_COUNT = 2;
+diff --git a/dwm.c b/dwm.c
+index c98678d..cc6ae80 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -1248,7 +1248,17 @@ propertynotify(XEvent *e)
+ void
+ quit(const Arg *arg)
+ {
+- running = 0;
++ unsigned int n;
++ Window *junk = malloc(1);
++
++ XQueryTree(dpy, root, junk, junk, &junk, &n);
++
++ if (n == EMPTY_WINDOW_COUNT)
++ running = 0;
++ else
++ printf("[dwm] not exiting (n=%d)
", n);
++
++ free(junk);
+ }
+
+ Monitor *
+--
+2.17.0
+
diff --git a/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ef3d847.diff b/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ef3d847.diff
deleted file mode 100644
index 047733ad..00000000
--- a/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ef3d847.diff
+++ /dev/null
_AT_@ -1,34 +0,0 @@
-From ef3d847677f5d8675c630fcea6c756881ca20659 Mon Sep 17 00:00:00 2001
-From: thatlittlegit <personal_AT_thatlittlegit.tk>
-Date: Sat, 28 Apr 2018 16:51:49 -0400
-Subject: [PATCH] Don't quit if not all windows are empty
-
----
- dwm.c | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/dwm.c b/dwm.c
-index c98678d..57043f2 100644
---- a/dwm.c
-+++ b/dwm.c
-_AT_@ -1248,7 +1248,16 @@ propertynotify(XEvent *e)
- void
- quit(const Arg *arg)
- {
--	running = 0;
-+	unsigned int n;
-+	Window *junk = malloc(1);
-+
-+	XQueryTree(dpy, root, junk, junk, &junk, &n);
-+
-+	if (n == 2) {
-+		running = 0;
-+	}
-+
-+	free(junk);
- }
- 
- Monitor *
--- 
-2.17.0
-
diff --git a/dwm.suckless.org/patches/onlyquitonempty/index.md b/dwm.suckless.org/patches/onlyquitonempty/index.md
index ec7781ef..1b968dfc 100644
--- a/dwm.suckless.org/patches/onlyquitonempty/index.md
+++ b/dwm.suckless.org/patches/onlyquitonempty/index.md
_AT_@ -8,12 +8,17 @@ On the default keybinding of Alt-Shift-Q, it is possible to press it by
 accident, closing all your work. This patch makes it so dwm will only exit via
 quit() if no windows are open.
 
+Because people may have different daemons, etc. open, you can configure the
+count considered to be 'empty' via `EMPTY_WINDOW_COUNT`.
+
 Download
 --------
 
-* [dwm-onlyquitonempty-20180428-ef3d847.diff](dwm-onlyquitonempty-20180428-ef3d847.diff)
+* [dwm-onlyquitonempty-20180428-ba1a2cb.diff](dwm-onlyquitonempty-20180428-ba1a2cb.diff)
 
 Author
 ------
 
 * thatlittlegit - <personal_AT_thatlittlegit.tk>
+
+index.md
Received on Sun Apr 29 2018 - 00:58:23 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 29 2018 - 01:00:34 CEST