You are not logged in.

#26 2014-07-20 05:40:55

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Gently close all programs during shut down from Gnome Shell

@silverhammermba

It has something called xkill.

Offline

#27 2014-07-20 19:52:51

qwerty12
Member
From: London
Registered: 2011-06-20
Posts: 34

Re: Gently close all programs during shut down from Gnome Shell

Thanks, Trilby, your program solved an issue I was having with Chromium under KDE where it would complain it was not shutdown properly if I restarted my laptop with it running.

Offline

#28 2014-07-21 17:16:49

dvdemon12
Member
Registered: 2014-07-10
Posts: 4

Re: Gently close all programs during shut down from Gnome Shell

have this same "issue" with firefox
i wish all my firefox instances which are automatically opened at startup to automatically resume session, but when issuing systemctl poweroff and booting again, firefox starts as if it crashed before

i tried to gracefully stop the firefox instances as per wmctrl page, but i see only 1 or sometimes none resume automatically (in firefox settings all instances are set to "show tabs from last time")

method to wmctrl:
wmctrl -lGp | grep Firefox | grep -v grep | awk '{print $1}' > firefox.txt
while read line
do
wmctrl -ci $line   #it does exit all firefox instances, but not sure if graceful
done < firefox.txt
rm firefox.txt

CTRL+Q on firefox and resuming again seems to do the job
but when i try to emulate a ctrl+q with wmctrl and xdotool in a script, wmctrl -ai xxxx does not work (desktop is awesome-wm, seems to be a bug as per some forums)

i will try the xkill program, thanks

Offline

#29 2014-07-24 16:21:46

silverhammermba
Wiki Maintainer
Registered: 2011-04-14
Posts: 156

Re: Gently close all programs during shut down from Gnome Shell

orschiro wrote:

@silverhammermba

It has something called xkill.

Interesting. Looking at the source of xkill, it looks like Trillby's little program is basically the same as

$ xkill -all

Which is kind of ironic since xkill's man page says "this program is very dangerous" and that "use of [-all] is highly discouraged". I thought the whole point was to gently close programs...

I am confused.

Last edited by silverhammermba (2014-07-24 16:22:07)

Offline

#30 2014-07-24 16:53:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Gently close all programs during shut down from Gnome Shell

Before I posted the code I was trying to find xkill as I knew such a thing already existed - frankly I don't know how I missed it.  So my code does not serve much of a purpose - except that it seems xkill will not actually kill all windows unless you manually click on the root window or do some other magic to verify that's what you really want to do.

As to why the xorg-xkill devs thought this was dangerous is beyond me - you'd need to ask them.  It will close every window, and if that's not what you wanted it could be unpleasant, but not dangerous.  I can't help but wonder if it's the type of safety label put on any tool that can do something useful.

To use xorg-xkill without having to click the root window, you'd have to modify the source code, or pair it in a script with something like xlsclients.  My code snipet will just (attempt to) kill all windows plain and simple - no checks to see if that's what you really wanted to do, no nany popup windows asking "are you sure you wish to exit windows close windows?" wink


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#31 2014-07-25 06:25:06

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: Gently close all programs during shut down from Gnome Shell

Trilby, I do not fully understand your comment. xkill is the X equivalent to kill, it kills a single process. The process is selected by clicking a window, much like pkill kills processes by understanding the base name. It was never meant as a killall replacement. Your utility is.

Offline

#32 2014-07-25 11:11:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Gently close all programs during shut down from Gnome Shell

Xkill has an option to kill all windows (-a) and it has all the code from my excerpt in the function called by that option [1].  So it clearly was intended to (be able to) do this.  But for some reason it was made intentionally clunky to actually do so, and the man page says not to use it.

EDIT [1] The function name is even "kill_all_windows" or something like that.

Last edited by Trilby (2014-07-25 11:12:47)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#33 2014-08-27 20:25:21

KreativeKrise
Member
Registered: 2014-03-11
Posts: 8

Re: Gently close all programs during shut down from Gnome Shell

Did anyone found a solution for this problem? Today I did a new installation on my notebook and this problem really bothers me. I did some research on Google, but without any success sad

Offline

#34 2014-08-28 05:57:20

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Gently close all programs during shut down from Gnome Shell

@KreativeKrise

Have you looked into the solution proposed by Trilby?

https://bbs.archlinux.org/viewtopic.php … 5#p1437765

Offline

#35 2014-08-28 19:49:53

KreativeKrise
Member
Registered: 2014-03-11
Posts: 8

Re: Gently close all programs during shut down from Gnome Shell

Yes I did, but without success sad

Offline

#36 2014-08-29 06:15:53

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Gently close all programs during shut down from Gnome Shell

KreativeKrise wrote:

Yes I did, but without success sad

Any error message? What is the actual result?

Offline

#37 2014-09-01 13:45:46

KreativeKrise
Member
Registered: 2014-03-11
Posts: 8

Re: Gently close all programs during shut down from Gnome Shell

No error messages, or let's say I couldn't find any useful information which are related to this issue.
The problem is, that Google Chrome still says that it wasn't closed correctly when I did a shutdown/reboot.

Offline

#38 2015-02-11 09:53:14

vilnius-leopold
Member
Registered: 2015-02-11
Posts: 1

Re: Gently close all programs during shut down from Gnome Shell

I wanted to achive something similiar with my openbox install. The only way for me to close windows gracefully was via `wmctrl -c`. Sending a SIGTERM or just killing the window/process would result in a crash report when opening up the application the next time (e.g. Firefox - restore tabs). The issue i had when calling `wmctrl -c` was that it wouldn't wait until the window is closed, thus you don't know when to e.g. call logout or shutdown (thus sending a SIGTERM/SIGKILL to still open windows). I created a little ruby package that solves this for me by polling the process pids listed with `wmctrl -lp` and waiting until all windows are closed. Maybe it helps someone else as well:
https://aur.archlinux.org/packages/close-all-windows/

Offline

#39 2015-05-17 22:51:23

visit
Member
Registered: 2013-06-03
Posts: 8

Re: Gently close all programs during shut down from Gnome Shell

This really annoyed me. So I present  my solution for Gnome.

Offline

#40 2015-05-18 23:56:53

Michael Catanzaro
Member
Registered: 2012-11-04
Posts: 49

Re: Gently close all programs during shut down from Gnome Shell

From a quick skim of this thread, I'd say you're probably looking at https://bugzilla.redhat.com/show_bug.cgi?id=1141137 which was recently fixed in Ubuntu but not upstream.

Offline

#41 2015-08-05 19:44:10

viktordick
Member
Registered: 2012-03-19
Posts: 16

Re: Gently close all programs during shut down from Gnome Shell

I have this problem not with chrome but with guayadeque, which is a music player whose features I really like. The problem is, when closing the window it shuts down orderly and saves the current position, so it can resume the playlist the next time it is started. If it is killed (even with SIGTERM), it does not. It even leaves a lock file ~/.guayadeque/.guayadeque-$USER and does not start again if that file is present (I have a script that deletes that file and starts guayadeque which is in my autostart).
So unless I explicitly close the music window (which is usually hidden in an icon or something), on shutdown the progress is lost and on the next boot the playlist starts from an earlier savepoint.
xkill also doesn't work btw. I would really need some way to close the window automatically when shutting down.

Offline

#42 2015-08-05 22:54:34

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 653

Re: Gently close all programs during shut down from Gnome Shell

Michael Catanzaro wrote:

From a quick skim of this thread, I'd say you're probably looking at https://bugzilla.redhat.com/show_bug.cgi?id=1141137 which was recently fixed in Ubuntu but not upstream.

Yes, that is the issue here. It's a change by systemd's Lennard Poettering with another of their "We're right, they're wrong" arguments causing this deadlocked bug of 18+ months. Some distros, at least Debian and Ubuntu, have reverted the commit. How annoying.

Offline

#43 2015-10-09 16:43:56

vith
Member
Registered: 2015-10-09
Posts: 5

Re: Gently close all programs during shut down from Gnome Shell

After reading all the redhat/fedora/github discussion about this I'm left puzzled.

https://github.com/systemd/systemd/pull … -137005614 is supposed to be mitigating the problem, right?

The referenced commits should be in systemd 226:

$ git tag --contains efdb023
v226
v227
$ git tag --contains e9db43d                                 
v226
v227

And we're on systemd 226:

pacman -Q systemd
systemd 226-3

But I still get complaints from applications having not cleanly exited after a reboot from the gnome menu.

Restore pages?

Chromium didn't shut down correctly.

Offline

#44 2015-10-09 19:00:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Gently close all programs during shut down from Gnome Shell

vith wrote:

https://github.com/systemd/systemd/pull … -137005614 is supposed to be mitigating the problem, right?

Is it?  I don't get that at all from reading that link.  Where do you see gently closing X mentioned there?  Even if it is supposed to address this issue, you still have to activate that with the kernel command line parameter.  Have you done that?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#45 2015-10-09 20:20:22

vith
Member
Registered: 2015-10-09
Posts: 5

Re: Gently close all programs during shut down from Gnome Shell

You were right that I had missed the part about needing to manually add the kernel parameter, unfortunately I just tested it and it hasn't helped.

I expected it to fix the problem because he said:

If you boot with that turned on the problem will go away now.

And linked to that comment from here https://github.com/systemd/systemd/issu … -137706966

Last edited by vith (2015-10-09 20:21:13)

Offline

#46 2015-10-09 20:53:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Gently close all programs during shut down from Gnome Shell

But what makes you connect that problem to the one discussed in this thread?  They are not talking about closing X client programs.

Systemd doesn't know anything about your x client programs - unless you do some odd gymnastics of starting every program as a user service.

EDIT: I suppose it does "know" about them as process IDs.  But systemd does not send X events to clients to kill them, this is what is needed to solve the problem discussed in this thread: hence my program and the discussion of xkill.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#47 2015-10-09 20:59:23

vith
Member
Registered: 2015-10-09
Posts: 5

Re: Gently close all programs during shut down from Gnome Shell

https://bugzilla.redhat.com/show_bug.cgi?id=1141137 has mention of both Gnome Terminal and https://github.com/systemd/systemd/issues/317 as the upstream bug (though in different comments by different people). You could be right that there's an unrelated bug somewhere else causing the same issue though. I don't know. I was just looking through the links in this Arch BBS thread trying to find a workaround.

Offline

#48 2015-10-09 21:08:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Gently close all programs during shut down from Gnome Shell

That's shell history, that has nothing to do with gently closing x clients.  I'm sorry, but those issues simply are not relevant to what is being discussed in this thread.  And SIGTERM and SIGKILL from the other link are also irrelevant: if chromium responded to those signals you would not have a problem.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#49 2016-03-08 08:25:52

OdinEidolon
Member
From: Belluno - Italy
Registered: 2011-01-31
Posts: 498

Re: Gently close all programs during shut down from Gnome Shell

This issue is still present on my system. I fixed it in KDE by linking the close-all-windows script from http://unix.stackexchange.com/questions … -archlinux in
~/.config/plasma-workspace/shutdown/


Hardware: 2016 Dell XPS15 - matte FullHD - i5-6300HQ - 32GB DDR4 - Nvidia GTX960M - Samsung 840EVO 250GB SSD - 56Wh
Software: Plasma 5 - rEFInd - linux-ck - preload - prelink - verynice - psd - bumblebee

Offline

#50 2016-11-26 14:39:42

saivert
Member
Registered: 2014-06-13
Posts: 19

Re: Gently close all programs during shut down from Gnome Shell

Sorry but this is a Chrome bug. Firefox does not exhibit this and always exits cleanly.
Also that mention of the systemd was really lame. I know it is too easy to blame all issues on systemd but it really derailed this thread.

Last edited by saivert (2016-11-26 14:40:02)

Offline

Board footer

Powered by FluxBB