sxmo-utils: Close windows in a more "graceful" way. v1 APPROVED

Fernando Ramos: 1
 Close windows in a more "graceful" way.

 1 files changed, 1 insertions(+), 1 deletions(-)
#442794 .build.yml success
> I would not want a popup in response to a swipe gesture to make a window
> go away.
But that is exactly what some applications might decide to do when
receiving a "SIGTERM".

The only difference between directly sending a SIGTERM and using
the WM_DELETE_WINDOW event is that you are using a different
callback (one that is more likely to have been registered by the
underlying toolkit the application is linked against) *and* that you
don't have to figure out the process ID (from the several that the
application might have created, such as in the case of Firefox).
On Sun, Feb 28, 2021, Miles Alan Wrote:
> We could do:
> - 3 taps vol down force kill
> - 4 taps vol down (or hold) for graceful kill
> And:
> - 2 finger swipe down graceful kill
> - 3 finger swipe down forceful kill
I also agree that this would be the perfect solution :)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/sxmo-devel/patches/20662/mbox | git am -3
Learn more about email & git

[PATCH sxmo-utils] Close windows in a more "graceful" way. Export this patch

It turns out "xdotool killwindow" simply calls "XKillClient()", as you can see
on xdotool's repo ("https://github1s.com/jordansissel/xdotool") here:
"cmd_windowkill.c:40" --> "xdo.c:1845".

This doesn't give the application inside the window any chance to do anything
which, in the case of Firefox, causes the "restore session" message to pop-up
the next time it runs (but, for some reason, not always).

I found out that using "xdotool key shift+alt+c" also closes the window while
giving the application an opportunity to gracefully shut down (this happens
because wdm sends the WM_DELETE_WINDOW message before killing the X window).
WARNING: While this new command is "nicer", it also does *not* immediately close
the window (ex: in the case of Firefox, a confirmation popup appears first).
This might *not* be what the "two fingers gesture" is meant to do. If so, feel
free to ignore this patch :)
 scripts/core/sxmo_killwindow.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/core/sxmo_killwindow.sh b/scripts/core/sxmo_killwindow.sh
index f55a076..d48f306 100755
--- a/scripts/core/sxmo_killwindow.sh
+++ b/scripts/core/sxmo_killwindow.sh
@@ -4,4 +4,4 @@
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"

xdotool windowkill "$(xdotool getactivewindow)"
xdotool key shift+alt+c
sxmo-utils/patches/.build.yml: SUCCESS in 21s

[Close windows in a more "graceful" way.][0] from [Fernando Ramos][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/20662
[1]: mailto:greenfoo@u92.eu

✓ #442794 SUCCESS sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/442794