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

[Review] Fix moving window to space in Sonoma 14.5 #3638

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

asmagill
Copy link
Member

Addresses #3636

@asmagill asmagill added the pr-fix Pull Request implementing a bug fix label May 25, 2024
Copy link

github-actions bot commented May 25, 2024

View Test Results

2 tests   2 ✔️  0s ⏱️
2 suites  0 💤
1 files    0

Results for commit 7848101.

♻️ This comment has been updated with latest results.

@asmagill
Copy link
Member Author

@cmsj the failure looks like a problem with the reporting? At any rate, unless I'm missing something I can ignore this I think... let me know if I'm wrong.

@nzhl
Copy link

nzhl commented Jun 6, 2024

When will this be merged? Can't wait to see the fixed version !

@dxgx
Copy link

dxgx commented Jun 9, 2024

I wait this merge every day :) Thanks for you work!

@bethandtownes
Copy link

me too

@nzhl
Copy link

nzhl commented Jun 17, 2024

is this repo deprecated ? It hasn't been updated for quite a while...

@latenitefilms
Copy link
Contributor

is this repo deprecated ? It hasn't been updated for quite a while...

@nzhl - Definitely not deprecated, however, @cmsj (the maintainer) has been busy with other things, so sadly Hammerspoon hasn't been updated in a while.

@asmagill - I could always build & sign locally and share a local build here if helpful?

@dxgx
Copy link

dxgx commented Jun 20, 2024

is this repo deprecated ? It hasn't been updated for quite a while...

@nzhl - Definitely not deprecated, however, @cmsj (the maintainer) has been busy with other things, so sadly Hammerspoon hasn't been updated in a while.

@asmagill - I could always build & sign locally and share a local build here if helpful?

@latenitefilms please do share build. Because my build is failing to organise windows to spaces. Thanks!

@gartnera
Copy link

I have a build on my fork: https://github.com/gartnera/hammerspoon/releases/tag/0.10.0

Tested on MacOS Sonoma 14.5.

@cunha
Copy link

cunha commented Jul 4, 2024

I've been using the version packaged by @gartnera above. Although I can move windows across Spaces on the same screen without issue, moving windows across Spaces on different screens is not working (the window apparently gets moved but is not visible).

I am considering the error might be in my Lua code calling the Hammerspoon API. Can anyone share Lua code that works when moving windows across Spaces on different screens so I can compare?

@irobertson
Copy link

I'm seeing similar issues to @cunha - moving a window to a space on a different screen results in the window being invisible. It appears that the cause is that the geometry of the window doesn't change, meaning that it's coordinates are still for the old screen. For now, I'm getting around this by calling window:moveToScreen in addition to calling moveWindowToSpace; I also have to add in a sleep of about a half a second between the two calls, or it ends up moving the window to the currently selected space on the screen containing the target space.

That said, even with the workaround needed, a huge thanks to @asmagill for making this change. It has been driving me nuts since upgrading to 14.5 that I haven't been able to use hammer spoon to move windows around. Your change makes a significant improvement to my day!

@dxgx
Copy link

dxgx commented Jul 8, 2024

I'm seeing similar issues to @cunha - moving a window to a space on a different screen results in the window being invisible. It appears that the cause is that the geometry of the window doesn't change, meaning that it's coordinates are still for the old screen. For now, I'm getting around this by calling window:moveToScreen in addition to calling moveWindowToSpace; I also have to add in a sleep of about a half a second between the two calls, or it ends up moving the window to the currently selected space on the screen containing the target space.

That said, even with the workaround needed, a huge thanks to @asmagill for making this change. It has been driving me nuts since upgrading to 14.5 that I haven't been able to use hammer spoon to move windows around. Your change makes a significant improvement to my day!

Yes i can confirm too. When i use multiple displays some windows that should appear in Mac book Built-in retina display appears hidden. Only "Window -> Move To Dell XXX" helps to "unhide" window

@jjournet
Copy link

jjournet commented Jul 26, 2024

Hi guys,
since the upgrade to Sonoma 14.5, I can't move window through spaces, and it's a major hindrance to my workflow.

I understand that open source project rely on the time available to maintainers, so I would be willing to help out on this one if required. I'm not fluent in Objective-C and Lua, but I'm willing to learn enough to unblock the situation (and I'm very familiar with Github workflows, so if that's the issue, I can help easily)

What would allow this to move forward ?

@cunha
Copy link

cunha commented Jul 26, 2024

The current workaround is to use the build by gartnera, and then change the Lua code to show windows when they are moved to different screens (see discussion in the previous posts).

For reference, this is how my Lua code looks at the moment (it's hacky, but beats moving windows with the mouse):

local function MoveWindowToSpace(sp)
    prefix.exit()
    local win = hs.window.focusedWindow()      -- current window
    local screenID, spaceID = getScreenSpaceID(sp)
    print("moving window to space " .. spaceID)
    spaces.moveWindowToSpace(win:id(), spaceID)
    win:focus()  -- follow window to new space

    -- MacOS takes focus from us. Get it f'ing back. This may cease to
    -- be an issue after we choose to "Reduce motion" in
    -- System preferences -> accessibility -> display.
    -- cunha@20240409 it's still an issue
    hs.timer.usleep(400000)
    -- moveToScreen may not be necessary after Sonoma fix is merged:
    -- https://github.com/Hammerspoon/hammerspoon/pull/3638#issuecomment-2209445157
    win:moveToScreen(screenID)
    win:focus()
end

@jjournet
Copy link

jjournet commented Aug 5, 2024

Hello @cunha , thank you for the workaround, I'll perhaps implement it if I don't have any other option (I'm trying to avoid installing fork or branch releases as much as possible on my work Mac)

My question was probably unclear. What would it take to have this PR to be merged and delivered with the official Hammerspoon ? I understand @asmagill fix is the solution, and he did an amazing job at fixing it, I just want to help if I can with any impediment in the PR that would prevent its merge.

@latenitefilms
Copy link
Contributor

I think the main bottleneck is that only @cmsj has the ability to push out a Hammerspoon release, and he's flat out with other things.

@cmsj
Copy link
Member

cmsj commented Aug 5, 2024

Sorry everyone, I know this has been super annoying!

@cmsj cmsj merged commit 63c8239 into Hammerspoon:master Aug 5, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-fix Pull Request implementing a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants