-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
window_destroyed signal fires before window is removed #154
Comments
I don't see a clean solution to this problem as long as the window_destroyed signal transmits both the window id and the window pid. |
Let's rephrase the question then: Iff This might break some scripts that rely on |
|
I've been wondering whether including the pid is necessary anyways. I've only needed to use it once, but I can get it from the wid anyways with a simple query. pid="$(yabai -m query --windows --window "${wid}") | jq -r '.pid'" |
Note that that query will not work in your handler for the window_destroyed signal script. |
Yeah, that was for all queries. The pid seems useless outside of the |
Should we just remove the pid from all window_* signals to be consistent? |
That's a breaking change as it shifts $2 to $1. I'm all for it though. Better break now than later. |
Fixed on master. |
Two small things:
|
Thanks for catching that, I was under the impression all window events had their args populated in the same codepath.
It's fixed, yes. Windows are now destroyed when the event is handled, before the signal is emitted. |
Bug report
The
event=window_destroyed
signal is unreliable, as querying windows from it may or may not include the destroyed window.This bug has been haunting me for weeks now, making me question my sanity and why signals were unreliable sometimes. I think I've found the root cause:
The signal is transmitted asynchronously before the event is processed internally by yabai. The actual handling of the event happens in the
event_destroy
function, which is called afterevent_signal_transmit
.yabai/src/event_loop.c
Lines 60 to 66 in b3eb9d1
The text was updated successfully, but these errors were encountered: