I have tried in XFCE the "Shut down" (not poweroff as I wrongly said) available from the GUI (Applications -> Logout -> Shut down). But I can as well type poweroff or "systemctl poweroff" in a terminal with the same effect.
It might seem like the same effect, but these are for completely different reasons. If you use an XFCE function to shut down and it does not send an X11 event to all child windows to close, then this is a bug with XFCE (this is #3 in my post in the other thread). You can use the xkillall type of program/script to work around this. If you use "systemctl poweroff" this is probably not a bug in the WM/DE, but you could submit a feature request to the dev team of that WM/DE to handle a sigterm (this is #4 in my post in the other thread). You can also use the xkillall type of program to work around this.
It is not at all surprising that this doesn't happen 100% of the time. Client programs failing to get a signal/event-message to shutdown is only one of the necessary conditions for this to occur.
]]>Now, when I click power off this does not happen. One could reasonably expect that the Windows manager/DE first perform a logout and then power off when you click power off. This this last thing that I call "buggy". Now I am somewhat confused about who exactly logout and what happens when you logout.
]]>This is a problem, but it cannot really be called a bug in any specific software as all software can perform to specifications and still result in this problem. The bug is in the "specifications", but as these are more emergent de-facto and/or consensus based policies, there is no where to appeal a change.
Just set your system up to deal with programs on their own terms. Some programs have signal handers, others have X11 event handlers. Some have both of course, and this is really nice, but not having both is really not a bug. So when you want to shut down a graphical session, send both the signals and the events and everything will be fine.
]]>I remove for now the Solved keyword since it was not properly solved.
]]>For the global setting, create a folder /etc/systemd/system.conf.d/ and then a file in there like "timeout.conf". Put for example this here in it:
[Manager]
DefaultTimeoutStartSec=30s
DefaultTimeoutStopSec=30s
If you do "systemctl daemon-reload" afterwards, the changes get applied immediately (without reboot needed).
To change just one service instead of everything, you can do this:
$ sudo systemctl edit servicename
Then type this here in the editor that comes up:
[Service]
TimeoutStopSec=5s