commit 2a5c58fd4ba2e7b41c6270acb79a0843c494bdc5
parent cb601f6c4e1cb556ae50877722600401bcce9fa6
Author: thatlittlegit <personal@thatlittlegit.tk>
Date: Sat, 28 Apr 2018 17:02:11 -0400
[dwm] Add onlyquitonempty patch
Diffstat:
2 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ef3d847.diff b/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ef3d847.diff
@@ -0,0 +1,34 @@
+From ef3d847677f5d8675c630fcea6c756881ca20659 Mon Sep 17 00:00:00 2001
+From: thatlittlegit <personal@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
+@@ -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
@@ -0,0 +1,19 @@
+onlyquitonempty
+===============
+
+Description
+-----------
+
+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.
+
+Download
+--------
+
+* [dwm-onlyquitonempty-20180428-ef3d847.diff](dwm-onlyquitonempty-20180428-ef3d847.diff)
+
+Author
+------
+
+* thatlittlegit - <thatlittlegit@protonmail.com>