Open pyinto opened 2 days ago
To fix this behavior I have a script that walks through all the spaces, and focus every window individually, but it's quite a work and takes time.
In that script I had to focus a space where those windows are located, because sometimes yabai will just throw an error on a legit "focusable" window: could not locate window with the specified id
or could not locate the window to act on!
. This part is not that easy to reproduce, but once I will found a way - will report it.
This is a macOS API limitation.
Some window properties are only accessible when yabai has a valid AX-reference for that window. This AX-reference can only be retrieved when the space that the window is visible on, is active. If windows are already opened on inactive spaces when yabai is launched, yabai can detect those windows and retrieve a limited amount of information about them. In addition, yabai window commands will NOT WORK for these windows. These windows can be identified by looking at the has-ax-reference property. Once the space that the window belongs to becomes active, yabai will automatically create an AX-reference. The queries will from that point forwards contain complete information, and the window can be used with yabai window commands.
The properties that contain incorrect information for windows with has-ax-reference: false are as follows:
{ "role": string, "subrole": string, "can-move": bool, "can-resize": bool }
There is no known workaround except for what you're already doing.
Edit: Note that window rules (or window commands in general with the exception of the query command) does not apply to these windows before has-ax-reference
is reported as true. That is when yabai is actually in control of that window.
The Issue
I've noticed that yabai sometimes doesn't return the correct attributes of certain windows. Now I have caught an example of such behavior that I can reproduce. This bug messes up my signals sometimes; that's how I found it. I think it's related to https://github.com/koekeishiya/yabai/issues/2320, but not sure yet.
Steps To Reproduce
Open native Calendar app on space 3; Now we have one calendar window on space 3 with:
{"title": "Calendar", "app": "Calendar"}
;Move your focus away from the space 3 to any other space:
yabai -m space --focus 1
Restart yabai:
yabai --restart-service
Query windows on space 3:
yabai -m query --windows --space 3 | jq
can-move
&can-resize
attributes - both set tofalse
for some reason! Which is not true, you can resize those windows!Focus main Calendar app window, in my case it's
2247
:yabai -m window 2247 --focus
Repeat step 3:
yabai -m query --windows --space 3 | jq
can-move
&can-resize
attributes - both set totrue
now, which is correct. Alsorole
andsubrole
are set now too, before it was empty.My Environment