Liupold/pidswallow

Sub-windows re-swallowing an alraedy swallowed parent

SeerLite opened this issue · 5 comments

It happens because our only check for a window already being swallowed is this line, which only checks if the current child window (cwid) has any window swallowed.

In the case of sub-windows (e.g. when a program creates a pop-up window), the child window will be different to the one that originally swallowed. This causes pidswallow to think it's our first time swallowing it and proceeds to do it again.

This isn't noticeable with default configuration because xdotool unmapwindow will just fail and not do anything. However, when using the recommended bspwm-specific configuration, bspc node {%pwid} --flag hidden=on has a very different result when {%pwid} is left as blank.

Right now it's late for me so this looks like a hard thing to solve, maybe even requiring some changes to how the /tmp files are handled. But I might wake up tomorrow and realize it's some easy check.

Ok I fixed it, technically. Some other issues might come up related to this later though. For example, when the sub-window becomes the main window and the first window is closed: the terminal would get vomited even though there's still windows.

We can check if parent is visible.

What do you mean?

What do you mean?

if the sub window become the main window the window id will be different.
(and it will vomit, seems like correct behavior)

we are checking (i forgot) if the parent is visible during swallowing. --only-visible .
[ -z "$pwid" ] && return 4 is the best we can do.

if the sub window become the main window the window id will be different.
(and it will vomit, seems like correct behavior)

IMO terminal should only be vomited when there's no windows left. But yeah, there's all kinds of crazy GUI out there that handle their windows in weirdest way. I wouldn't worry too much about it for now unless someone complains.