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

"Move to window to space" feature leaves a copy of the window on the old space #1174

Closed
hetul opened this issue Dec 30, 2021 · 6 comments
Closed

Comments

@hetul
Copy link

hetul commented Dec 30, 2021

Describe the bug
When using the hotkey to move a window to a different workspace, the window is also left on the old space (the window will actually appear in both the new space and the old space).

When using the hotkey again, the window will appear in 2 spaces (in practice, it will stick to the space it originally started in, and whatever latest space you assigned it to).

Applications:
This happened on all windows that I tried.

To Reproduce

  • Start Amethyst
  • Press the hotkey to assign the window to a different space
  • Go back to the original space, and observe that the window is still there. It is also on the new space

Expected behavior
The window should not appear on the old space, once it has been assigned to a new space

Screenshots
N/A

Versions:

  • macOS: Monterey 12.1 (MacBook Pro 14-inch, 2021)
  • Amethyst: 0.15.5

Debug Info
I can add this later if needed. I ended up uninstalling for now so I don't have debug info.

Additional context
I looked into the source code a bit over here: https://github.com/ianyh/Amethyst/blob/development/Amethyst/Model/Window.swift#L315-L316

Amethyst uses private APIs to move windows around.

I suspect, that in the latest version of OSX, the CGSRemoveWindowsFromSpaces private API no longer removes the window from a space if it would leave the window with no spaces.

Simply re-ordering the calls to "Add Windows to Spaces" and "Remove Windows from Spaces" may solve the issue.

I actually made my own xcode project to switch spaces around using the same APIs, and found that re-ordering the calls solves the issue there.

I would put up a pull request to fix the code in Amethyst, but I don't currently have the time to figure out how to build/test Amethyst (and make sure it doesn't break on older OSX versions). If I do get a chance later, I'll come back here and set up a PR.

@haukebruno
Copy link

I can confirm this. Upgraded to Monterey yesterday and have the same issue now. My Amethyst is also on 0.15.5

@rdamazio
Copy link

rdamazio commented Jan 6, 2022

+1, also seeing this on Monterey 12.1 - especially annoying in combination with #1167 since upon waking from sleep I need to keep moving windows back to their proper space.

@IshaanG
Copy link

IshaanG commented Jan 13, 2022

Can confirm, having the same issue on Monterey.
As a temporary workaround, if you have follow thrown window disabled, pressing the hotkey twice removes the window from current workspace. Hope there is a fix soon.

@dzanotto
Copy link
Contributor

Same problem here, after upgrading to Monterey 12.1
I've testes also the fix mentioned by @hetul and it works, both with "follow thrown window..." enabled and disabled.

@antoniopantaleo
Copy link

Same problem here, after upgrading to Monterey 12.1
I've testes also the fix mentioned by @hetul and it works, both with "follow thrown window..." enabled and disabled.

Hasn't this been merged?

@dzanotto
Copy link
Contributor

Hasn't this been merged?

I've just created a PR for it -> #1184

@ianyh ianyh closed this as completed Jan 21, 2022
ianyh added a commit that referenced this issue Jan 21, 2022
* development:
  add regex suuport to floating windows title matching (#1166)
  Get the build going (#1185)
  Fix for move to window to space - #1174 (#1184)
  Update cocoapods in Gemfile (#1159)
ianyh added a commit to reyk/Amethyst that referenced this issue May 7, 2022
* development:
  Throw window to any space across multiple screens. (ianyh#1209)
  Make TwoPane layout adaptive to screen orientation (ianyh#1182)
  Minor fix (line 69) (ianyh#1230)
  Bump cocoapods-downloader from 1.5.1 to 1.6.3 (ianyh#1226)
  Fix the layout HUD when multiple screen are arranged vertically (ianyh#1162) (ianyh#1163)
  Bump version to 0.15.6 (ianyh#1205)
  Remove errant link (ianyh#1207)
  Replace gitter with GitHub Discussions (ianyh#1206)
  Update Window.swift (ianyh#1203)
  Fix setup.sh so that it correctly checks for rbenv (ianyh#1198)
  add regex suuport to floating windows title matching (ianyh#1166)
  Get the build going (ianyh#1185)
  Fix for move to window to space - ianyh#1174 (ianyh#1184)
  Update cocoapods in Gemfile (ianyh#1159)
  Remove travis file (ianyh#1158)
  Create GitHub Action for running tests (ianyh#1157)
  Add some common macOS agents to ignored list (ianyh#1156)
  Bump addressable from 2.7.0 to 2.8.0 (ianyh#1136)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants