sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 80f73293c4150a1dfd79a627c916595e9f7a58e2
parent 8cf3b690c7ef81290c294074aa4214c7dbdfc994
Author: thatlittlegit <personal@thatlittlegit.tk>
Date:   Sat, 28 Apr 2018 18:56:08 -0400

[dwm] Fix onlyquitonempty patch to make it configurable

Diffstat:
Adwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ba1a2cb.diff | 46++++++++++++++++++++++++++++++++++++++++++++++
Ddwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ef3d847.diff | 34----------------------------------
Mdwm.suckless.org/patches/onlyquitonempty/index.md | 7++++++-
3 files changed, 52 insertions(+), 35 deletions(-)

diff --git a/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ba1a2cb.diff b/dwm.suckless.org/patches/onlyquitonempty/dwm-onlyquitonempty-20180428-ba1a2cb.diff @@ -0,0 +1,46 @@ +From ba1a2cbf2a04992e05f0168965043d9335b742b9 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 + +--- + 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 +@@ -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 +@@ -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", 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 @@ -1,34 +0,0 @@ -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 @@ -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@thatlittlegit.tk> + +index.md