-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hs.spaces.moveWindowToSpace not working #3636
Comments
Facing the same issue, 14.4.1 worked, but after 14.5, not any more. |
It appears macOS 14.5 changed some functions to protected which could be the reason for our symptoms. |
Looks like they were able to achieve the same functionality in another way: koekeishiya/yabai@7bacdd5 |
I've observed that it still works for me with Hammerspoon's own windows, but not with any other app's windows. |
@cmsj, it looks to me like yabai added the function to their script injection payload; without doing something similiar (requiring SIP changes and an elevated permissions helper app) I'm not sure we'll be able to accomplish the same. It might be better to see how closely we can work with yabai and come up with a module/spoon/process for utilizing it as our "helper" or "companion" app. |
Aha. Yeah closer integration with yabai is an interesting option. We could also just get out of the business of pretending that Apple wants us interacting with Spaces in the first place 😬 |
If hammerspoon can't directly invoke an Apple method to move a window to a space, it would still be nice to provide a utility function to accomplish this same task manually. Similar to how Here's a work-around replacement for It involves programmatically clicking a window's title bar, switching to a space, and dragging the window to the new space. This has the limitation that you can't move a window to or from a non-visible space, but it's better than nothing. Note: I tried this with |
See this commit for a SIP friendly (enabled) solution koekeishiya/yabai@98bbdbd A little note/mention/credit would be appreciated if my solution is used. |
I can confirm @koekeishiya's suggestions seems to work (at least for now, curse you Apple!). I need to do some more testing and it will probably be a couple of days before I can put together a formal pull-request (though I'm fine if someone else wants to have a go at it sooner). @koekeishiya, what type of notification would you consider appropriate? Normally, I will add comments in the source as to where specific changes/additions are from and add a line or two with links in the documentation (both internal to Hammerspoon and what is ultimately published in our pages) for the relevant module. If you'd like something more, or if there are other licensing concerns, let us know! |
That will do just fine. |
Closing since the PR is merged. |
very sorry to annoy again: unfortunately, yesterday i updated to MacOS Sequoia 15.0 Beta (24A5298h). the new fix does not work for me and the issue remains ( |
Does Yabai work in 15beta? |
According to https://github.com/koekeishiya/yabai/blob/master/CHANGELOG.md
So, yes, but not in a way we can easily mimic. I'll keep on eye on it; IIRC, when Sonoma first came out, injection was the only fix as well, so it might change. Or it might be time to admit defeat and move spaces to more of a yabai wrapper. |
There does not appear to be other ways. All 3 functions I used in my Sonoma 14.5/6 workaround got NOP'd by Apple in Sequoia-- they nuked the implementation in the WindowServer. The remaining functions all have rights checking on the WindowServer connection. You either need to be the owner of the window, or the system universal owner (Dock.app). |
Is |
´moveWindowToSpace´ works as expected in the latest version of macOS Sonoma; however, it does not in macOS Sequoia. |
@franzbu can confirm is does not work, is not working for me either |
hammerspoon/extensions/spaces/libspaces.m Line 189 in 08cb813
|
This seems relevant to Sequoia :/ |
For me |
@jdtsmith Hi, I can confirm this hack works on macOS Sequoia 15.0.1, thank you so much! |
Hello, is this intentionally closed? Is there a fix for this? Moving window to another screen worked for me before upgrading it to Sequoia. |
For others coming for the same reason, this issue was resolved with Sonoma (14.5.x) after Apple changed the API. Then Apple disabled that API in Sequoia (15.x). You can follow the discussion in #3698.
|
the following code snippet used to work for me, but stopped working a few weeks ago. the snippet is responsible for finding the current terminal window, moving it to the active space, and activating it. unfortunately, the window is not moved by hammerspoon. the line
hs.spaces.moveWindowToSpace(app:mainWindow(), currentSpace)
is not working as it should, and returnstrue
even though the window was not succesfully moved.can anyone reproduce the issue and/or does anyone have any ideas on how to fix this? unfortunately, i do not exactly know what i have changed, it could be also be a macOS update that is at fault here. i use macOS 14.5 Beta (23F5064f).
The text was updated successfully, but these errors were encountered: