koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
22.48k stars 630 forks source link

"could not locate window with the specified id" or "could not locate the window to act on!" #2320

Open pyinto opened 1 month ago

pyinto commented 1 month ago

Having some issues when I try to focus specific app by it's ID, it was hard to debug because I don't have any concrete steps to reproduce this behavior, and list of the apps affected differs too. Recently I cough one of such examples when my debug logs was open, here how it looked like:

$yabai -m query --windows
{
        "id":527,
        "pid":19161,
        "app":"Telegram",
        "title":"",
        "scratchpad":"",
        "frame":{
                "x":3368.0000,
                "y":-594.0000,
                "w":1676.0000,
                "h":2968.0000
        },
        "role":"",
        "subrole":"",
        "root-window":true,
        "display":2,
        "space":5,
        "level":0,
        "sub-level":0,
        "layer":"normal",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"none",
        "stack-index":0,
        "can-move":false,
        "can-resize":false,
        "has-focus":false,
        "has-shadow":true,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":false,
        "is-native-fullscreen":false,
        "is-visible":false,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":false,
        "is-sticky":false,
        "is-grabbed":false
}

Then I try to switch to it and next thing happens:

$ yabai -m window --focus 527
could not locate window with the specified id '527'.
$ yabai -m window --focus '527'
could not locate window with the specified id '527'.

or

could not locate the window to act on!

The app is the only visible app in space 5 (when I am at space 6 if that matters) on my second display. I didn't restart it, nor did I restart Yabai, and suddenly it's working again. Here is a query response for that window after it started to work again:

{
        "id":527,
        "pid":19161,
        "app":"Telegram",
        "title":"Telegram",
        "scratchpad":"",
        "frame":{
                "x":3368.0000,
                "y":-594.0000,
                "w":1676.0000,
                "h":2968.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":2,
        "space":5,
        "level":0,
        "sub-level":0,
        "layer":"normal",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"second_child",
        "stack-index":0,
        "can-move":true,
        "can-resize":true,
        "has-focus":false,
        "has-shadow":true,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":true,
        "is-native-fullscreen":false,
        "is-visible":false,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":false,
        "is-sticky":false,
        "is-grabbed":false
}

As you can see both role and subrole were messed up, but again, it was perfectly fine window that was working as usual, I did nothing to fix and it works. It's not about this specific app, it happens rarely and randomly with a list of apps.

Any ideas what's going on or how I can fix it? I also sometimes experience issues when my queries are taking much more time to respond, but I guess that's not related. Would be great to hear your thoughts or propositions on how to further investigate it. Thanks!

Mac OS: 14.5 (23F79) yabai-v7.1.1 No scripting additions installed.