Skip to content
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

bug: some windows incorrectly returned by query #2175

Closed
rwijtvliet opened this issue Mar 20, 2024 · 4 comments
Closed

bug: some windows incorrectly returned by query #2175

rwijtvliet opened this issue Mar 20, 2024 · 4 comments

Comments

@rwijtvliet
Copy link

rwijtvliet commented Mar 20, 2024

I have noticed that yabai -m query --windows --space X returns windows that are not on space X.

For example:

$ yabai -m query --windows | jq -r '.[] | "\(.space) \(.id) \(.app)"'
7 9751 Microsoft Teams (work or school)
7 9752 Microsoft Teams (work or school)
2 9906 Alacritty
8 379 Firefox
2 9659 Microsoft Teams (work or school)
2 563 Microsoft Outlook
5 8736 Microsoft Teams (work or school)
3 7215 Google Chrome
5 9694 Microsoft Excel
5 1042 Alacritty

Note that there are no windows on space 4. However, restricting the query to space 4 does return some windows -- from space 7:

$ yabai -m query --windows --space 4 | jq -r '.[] | "\(.space) \(.id) \(.app)"'
7 9751 Microsoft Teams (work or school)
7 9752 Microsoft Teams (work or school)

Additional information:

  • I've noticed this is the case only for Microsoft apps: Teams and Outlook. For Outlook, it is the calendar reminders that are included.

  • Below I've added the full output without jq filtering.

  • The titles of the 2 windows do contain "sharing" in their names ("Sharing control bar" and "Sharing indicator"), so it may be by design. Still, I expect (and prefer) to not see them in the data returned by the query which has the --space 4 added.

yabai -m query --windows 
[{
        "id":9751,
        "pid":97788,
        "app":"Microsoft Teams (work or school)",
        "title":"Sharing Indicator",
        "frame":{
                "x":0.0000,
                "y":0.0000,
                "w":3008.0000,
                "h":1692.0000
        },
        "role":"AXWindow",
        "subrole":"AXSystemDialog",
        "root-window":true,
        "display":1,
        "space":7,
        "level":2147483631,
        "sub-level":0,
        "layer":"unknown",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"none",
        "stack-index":0,
        "can-move":true,
        "can-resize":false,
        "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":true,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":9752,
        "pid":97788,
        "app":"Microsoft Teams (work or school)",
        "title":"Sharing control bar | Microsoft Teams",
        "frame":{
                "x":1359.0000,
                "y":25.0000,
                "w":290.0000,
                "h":35.0000
        },
        "role":"AXWindow",
        "subrole":"AXSystemDialog",
        "root-window":true,
        "display":1,
        "space":7,
        "level":24,
        "sub-level":0,
        "layer":"unknown",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"none",
        "stack-index":0,
        "can-move":true,
        "can-resize":false,
        "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":true,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":9906,
        "pid":11889,
        "app":"Alacritty",
        "title":"bash;#toggleterm#1 - (term://~/.dotfiles/windowmanager/macos//4
2115:/opt/homebrew/bin) ((1) of 3) - NVIM",
        "frame":{
                "x":10.0000,
                "y":35.0000,
                "w":1637.0000,
                "h":1620.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":2,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":1.0000,
        "split-type":"vertical",
        "split-child":"first_child",
        "stack-index":0,
        "can-move":true,
        "can-resize":true,
        "has-focus":true,
        "has-shadow":false,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":true,
        "is-native-fullscreen":false,
        "is-visible":true,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":false,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":9659,
        "pid":97788,
        "app":"Microsoft Teams (work or school)",
        "title":"Anfrage | Microsoft Teams",
        "frame":{
                "x":1657.0000,
                "y":35.0000,
                "w":1340.0000,
                "h":885.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":2,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":0.7500,
        "split-type":"horizontal",
        "split-child":"first_child",
        "stack-index":0,
        "can-move":true,
        "can-resize":true,
        "has-focus":false,
        "has-shadow":false,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":true,
        "is-native-fullscreen":false,
        "is-visible":true,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":false,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":563,
        "pid":4821,
        "app":"Microsoft Outlook",
        "title":"Inbox",
        "frame":{
                "x":1657.0000,
                "y":930.0000,
                "w":1340.0000,
                "h":724.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":2,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":0.7500,
        "split-type":"horizontal",
        "split-child":"second_child",
        "stack-index":0,
        "can-move":true,
        "can-resize":true,
        "has-focus":false,
        "has-shadow":false,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":true,
        "is-native-fullscreen":false,
        "is-visible":true,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":false,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":379,
        "pid":2596,
        "app":"Firefox",
        "title":"Credit Mandate",
        "frame":{
                "x":-1718.0000,
                "y":623.0000,
                "w":1708.0000,
                "h":1032.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":2,
        "space":8,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"second_child",
        "stack-index":0,
        "can-move":true,
        "can-resize":true,
        "has-focus":false,
        "has-shadow":false,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":true,
        "is-native-fullscreen":false,
        "is-visible":true,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":false,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":8736,
        "pid":97788,
        "app":"Microsoft Teams (work or school)",
        "title":"Chat | Microsoft Teams",
        "frame":{
                "x":2196.0000,
                "y":35.0000,
                "w":801.0000,
                "h":1620.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":5,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":0.7500,
        "split-type":"vertical",
        "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
},{
        "id":7215,
        "pid":62695,
        "app":"Google Chrome",
        "title":"New Tab - Google Chrome",
        "frame":{
                "x":10.0000,
                "y":35.0000,
                "w":2988.0000,
                "h":1620.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":3,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "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
},{
        "id":9694,
        "pid":74560,
        "app":"Microsoft Excel",
        "title":"240319 Template GmbH(67).xlsx  - 
 Read-Only",
        "frame":{
                "x":10.0000,
                "y":35.0000,
                "w":2988.0000,
                "h":1620.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":5,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":0.7500,
        "split-type":"vertical",
        "split-child":"second_child",
        "stack-index":0,
        "can-move":true,
        "can-resize":true,
        "has-focus":false,
        "has-shadow":false,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":true,
        "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
},{
        "id":1042,
        "pid":6690,
        "app":"Alacritty",
        "title":"python3 - (term://~/python/portfolyo//32864:/Users/ruud.wijtvli
et/python/portfolyo/.venv/bin) - NVIM",
        "frame":{
                "x":10.0000,
                "y":35.0000,
                "w":1191.0000,
                "h":1620.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":5,
        "level":0,
        "sub-level":-20,
        "layer":"normal",
        "sub-layer":"below",
        "opacity":0.7500,
        "split-type":"vertical",
        "split-child":"first_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
}]

and

yabai -m query --windows --space 4
[{
        "id":9751,
        "pid":97788,
        "app":"Microsoft Teams (work or school)",
        "title":"Sharing Indicator",
        "frame":{
                "x":0.0000,
                "y":0.0000,
                "w":3008.0000,
                "h":1692.0000
        },
        "role":"AXWindow",
        "subrole":"AXSystemDialog",
        "root-window":true,
        "display":1,
        "space":7,
        "level":2147483631,
        "sub-level":0,
        "layer":"unknown",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"none",
        "stack-index":0,
        "can-move":true,
        "can-resize":false,
        "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":true,
        "is-sticky":false,
        "is-grabbed":false
},{
        "id":9752,
        "pid":97788,
        "app":"Microsoft Teams (work or school)",
        "title":"Sharing control bar | Microsoft Teams",
        "frame":{
                "x":1359.0000,
                "y":25.0000,
                "w":290.0000,
                "h":35.0000
        },
        "role":"AXWindow",
        "subrole":"AXSystemDialog",
        "root-window":true,
        "display":1,
        "space":7,
        "level":24,
        "sub-level":0,
        "layer":"unknown",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"none",
        "stack-index":0,
        "can-move":true,
        "can-resize":false,
        "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":true,
        "is-sticky":false,
        "is-grabbed":false
}]
@rwijtvliet
Copy link
Author

My current workaround is to filter the output again, like so:

yabai -m query --windows --space 4 | jq -r ".[] | select (.space == 4)"

@rwijtvliet rwijtvliet changed the title bug: some windows incorrectly returned bug: some windows incorrectly returned by query Mar 20, 2024
@koekeishiya
Copy link
Owner

If they show up, then according to macOS they do in fact belong on space 4. Every entry is the result of that window being returned from macOS for that space id: CFArrayRef window_list_ref = SLSCopyWindowsWithOptionsAndTags(g_connection, cid, space_list_ref, options, &set_tags, &clear_tags);

This is likely because these specfic teams windows do something weird with collection behavior and other stylemask settings. https://developer.apple.com/documentation/appkit/nswindow/1419471-collectionbehavior

Both offending windows have "subrole":"AXSystemDialog", and irregular levels "level":2147483631, "level":24,

@koekeishiya
Copy link
Owner

These windows should probably show as is-sticky: true on the latest master.

@rwijtvliet
Copy link
Author

Thanks for that fast reply. I understand it's a Mac-peculiarity, and will just keep using my workaround (or filter on non-sticky windows when that feature reaches production).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants