How to simulate closing a window from the command line with /usr/bin/killall?
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to simulate closing a window from the command line with /usr/bin/killall?
When I shutdown my computer with /sbin/shutdown, the computer shuts down. However, if I had any firefox windows open when I shutdown, then when I restart firefox, I get the "Firefox was not properly shutdown" message.
I am working on a shutdown script to close firefox before calling shutdown. I have tried killall -s $x firefox, where $x is HUP, INT, QUIT, and a few others, but firefox is shutdown improperly every time.
How can I simulate clicking on the "X" in the window's corner within a script?
I have a similar shutdown script that I use, and if I recall correctly, I use wmctrl to send a 'close' message (not quite sure though - I'm currently at work so I'll have to check when I get home).
it is as somethingfoo said : the only way to quit properly a graphical application is by using a window manager message (to simulate click on the "X" in the window corner), i'm not familiar with it so i'll let someone else explain how to do
this is true for graphical applications, otherwise, in order to kill processes on a shutdown, the signal which seems appropriated is HUP (means ancestors of the process are quitting, process needs to quit, to avoid zombies)
if i remember well, when in the good runlevel, the INIT process sends to all remaining processes a TERM, then a KILL signal, so there wouldn't be a need to send theses signals before... unless you really need to have a process killed to do job with its results
Yes. That is the default signal for killall. I also tried explicitly specifying it, as well as others. I should have mentioned TERM in the list of signals I've tried. As KrahnacK said though, that one is sent automatically anyway.
Quote:
Originally Posted by somethingfoo
I have a similar shutdown script that I use, and if I recall correctly, I use wmctrl to send a 'close' message (not quite sure though - I'm currently at work so I'll have to check when I get home).
Thanks. I suspected that the close button did more than just send a signal. I'll look into using wmctrl if I have this problem in the future.
Quote:
Originally Posted by keratos
one option is to turn off this firefox feature. its called "resume from crash".
Thanks. That's the best solution for me. I never used that feature anyway. Unless I experience any problems, I'll keep this feature disabled.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.