Request for help in replicating window to next space #2621
-
Hello! I'm the maintainer of Sol, which is an open source command launcher (think raycast). Sol has very simple window management integrated within the app. Most of it works just fine, but recently I wanted to add spaces management. Spaces are not a public macOS api, so it seems most of the apps that have managed to get this working are either working with the private APIs or have found ways around. Someone pointed me to this repo, and it seems yabai is able to move windows between spaces. I've taken a look into the code and it seems to be using the same API as I do. However, when I try to call the functions nothing happens. As a data point, raycast is able to move windows between spaces in quite a funky manner: OSP.000943.mp4Ideally I would like to replicate this functionality. Is any of the maintainers willing to give a hand? I have my code in this branch, which as stated uses the same code as yabai yet nothing happens when I try to move the windows between spaces. If this is too much to ask, feel free to close this discussion, don't mean to step in anybodies toes here :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
So the function you are calling To use the functions that Apple made protected, you need to be in control of the "universal owner" WindowServer connection. Other software that can move spaces synthesizes mouse-input to literally drag the window to another space. Sorry for the terse reply; I've commented on this so many times in the issue tracker that I've lost count. |
Beta Was this translation helpful? Give feedback.
So the function you are calling
..SetWindowListWorkspace
was a workaround I kept around for years and applied when Apple added protections to the functions that I was originally using. Shortly after I made it public (the next macOS patch) they removed that functionality and replaced it with a stub in the WindowServer. Not sure me making it public was the trigger to fix it, but the timing seems suspicious to me anyway.To use the functions that Apple made protected, you need to be in control of the "universal owner" WindowServer connection.
Yabai does this by injecting code into Dock.app (which requires disabling certain parts of SIP) and then uses those APIs.
Other software that can move …