wmutils / core

Set of window manipulation tools
Other
714 stars 33 forks source link

`killw` kills all Firefox windows instead of only the current one #15

Closed greduan closed 9 years ago

greduan commented 9 years ago

As the title says, I find this annoying as killing one (private) window does not mean I want to close the entire browser.

I've had to restart Firefox several times because of this and I thought I should report it as a bug, since I don't think this is intended behaviour.

Although restarting Firefox is probably good for memory usage, it's certainly not the best workflow. lol

SeraphimRP commented 9 years ago

Try using CTRL+W to close one window (implying the other tabs are closed).

Vibex commented 9 years ago

What vypr says is a solution, but I think it would be nice if you could kill just one window instead of all the windows in that process.

dedcat commented 9 years ago

wmutils will not switch to using EWMH.

If you want this behavior, use another program for killing windows.

greduan commented 9 years ago

So this depends on EWMH? But I've checked and when I do lsw every Firefox window has a different WID...

But yes I've started using Ctrl+w meanwhile

z3bra commented 9 years ago

when you fire up 'killw' on a window, it only close the window, but in a sort of brutal way. killw is not meant to gently close a window, its meant to kill a window. EMWH has a way to request a window to close itself, but has said, wmutils isn't designed to use EWMH.

Note that this is not related to firefox only. All webbrowsers starts tons of windows to catch up key events and such, and having them closed is not an expected behavior, so firefox might consider that when one of its child windows dies, something is wrong, and then shutdown completely.

So as killw only force ONE window to close (and not its parents or children), this could not be considered a bug in killw. It is just a side effect on how firefox react to Xorg killing one of its windows

greduan commented 9 years ago

OK, thanks z3bra. :)

clehner commented 8 years ago

I'm revisiting this issue because I have been experiencing the behavior that killw closes multiple windows, with the surf browser. To open a new window, surf forks and execs itself. I think that the child processes are reusing the parent's XCB connection from some inherited GTK memory. I looked into the i3 source and found that it uses xcb_destroy_window to close a window (as a fallback for EWMH). Is there an advantage to using xcb_kill_client which kills the X11 client owning a window, vs. xcb_destroy_window which kills a specific window?

Ferdi265 commented 8 years ago

It should be worth mentioning that killwa from the contrib repo DOES kill single windows correctly. I haven't had time looking into its source yet, though.

clehner commented 8 years ago

@Ferdi265 Thanks, I didn't see that. Looks like killwa uses EWMH WM_DELETE_WINDOW and then falls back to xcb_kill_client. It should probably fall back to xcb_destroy_window instead. I'll make a PR with my proposed changes

z3bra commented 8 years ago

The advantage of xcb_kill_client is that it gives the possibility to kill a frozen or misbehaving client and all its children from a single application. It is IMO more useful than using the WM_DELETE_WINDOW, as all clients already include a way to close themselves "properly" (be it escape, ctrl+w or ctrl+d). Also, this atom is specified by the ICCCM standard and is thus not supported by all applications. The xcb_destroy_window() is much better there because it asks directly to the server to close the window, so it will always work. Thanks for the proposal!

clehner commented 8 years ago

@z3bratabs thanks, that makes sense.

CamilleScholtz commented 8 years ago

I already created a tool that does exactly this using atoms, it's in contrib: https://github.com/wmutils/contrib/tree/master/killwa