-
Notifications
You must be signed in to change notification settings - Fork 21
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
Moving to a Chrome window changes focus to other Chrome window on another monitor #14
Comments
Hello, I got a second monitor to try this out, but I can't seem to duplicate it. I created a Chrome window on Monitor 1 and Monitor 2 (which is Mission Control Space 1 and Mission Control Space 2) along with some other application windows. I used the PaperWM.spoon keyboard shortcuts to change focus between the Chrome window and other windows on Space 1. I used the PaperWM.spoon keyboard shortcuts to change focus between the Chrome window and other windows on Space 2. I used the mouse to change focus between the Chrome window and other windows on Space 1. I used the mouse to change focus between the Chrome window and other windows on Space 2. When selected with mouse or keyboard, focus always returned to the Chrome window on the active Space. Perhaps something has changed with recent versions of Hammerspoon, Macos, or Chrome. My current setup is: |
Interesting. I will retry and see if I can reproduce. It's always been a problem for me when navigating between desktops instead of using PaperWM.spoon. Very possible I just haven't configured PaperVM.spoon properly (regarding MacOS display/window management settings). Edit: Really appreciate you testing it. Thanks. |
I tried adding some behavior to find a window to focus before switching to a new Mission Control space. Would you like to try it out in this branch and see if helps your Chrome window issue at all? https://github.com/mogenson/PaperWM.spoon/tree/focus-window-before-switching-space |
@mogenson so tested this with a Chrome and VSCode window open on 1 screen, and again a Chrome and VSCode window on another screen. For some reason I can get into a state where I can move the tiles on both screens at once with the keyboard. Just confirmed I can still reproduce the original issue on your |
Seems like it may all be related to this issue: Hammerspoon/hammerspoon#370 |
That was an informative read! I'll try out the raise app then focus window technique to see if it helps. Spawning hidden windows may be an overkill solution for PaperWM.spoon. |
I pushed a new commit to the https://github.com/mogenson/PaperWM.spoon/tree/focus-window-before-switching-space branch to raise an application before focusing it's window in a new space. See if this behavior performs any better for you. From my testing, there are still some times when switching between spaces (especially spaces where there are windows of the same app, ie Chrome) when a window on the new space is not focused. As a work around, I've noticed that if I press the switch to space keyboard shortcut again, a window will be selected and focused the second time. |
@mogenson I think that's working much better! I will need to give it more time to see how it goes. I will use it throughout work for the next couple of days. So in regards to your caveat, is that the issue where it seems to move both spaces at the same time? (assuming a space is a monitor/screen). So for example:
Hard to demonstrate without a video. Maybe I can try find a solution to record both monitors at the same time if needed. Edit: It seems my Edit2: Hmmm using it further, it seems to be a lot worse than expected. Somehow I have windows that aren't navigable via keyboard commands etc. I might try help diagnose by playing with the code. |
Sorry to hear that. If there are stability issues I won't merge this branch into main. I have ⌘1 mapped to switch to space 1. Sometimes when I press that shortcut, the space will switch but a window will not be focused in space 1. I've noticed that if I press ⌘1 again, now a window will be focused in space 1. |
Does that shortcut not clash with switching tabs in a browser? (e.g. in Chrome, ⌘1 will switch to tab 1). |
I have a specific PaperWM.spoon layer for keyboard shortcuts. But that shouldn't affect how the switchToSpace() method works. |
I know there's still some issues with multiple monitors, but I'm going to merge the commits from https://github.com/mogenson/PaperWM.spoon/tree/focus-window-before-switching-space as part of #15. They've been working reasonably well for me for the past few weeks. If there's any catastrophic bugs or crashes I'll go in and revert them. |
@mogenson apologies for the lack of response, but no problem! :) Thanks for being active. The refresh idea in your latest commit might actually be super useful to me. Will give it a go. |
Hey! I'm running into this issue too. Was this ever merged and released? If I "focus left/right" onto a Safari window while having a Safari window open on my second display it focuses that one instead. This kind of "steals" the whole focus away into that separate space. |
PR #53 works well enough for me. I haven't seen Chrome steal a window focus back. Closing this as fixed for now. |
Hey, sorry for getting back to you so late. Was this merged to the |
PR #53 is in the There's a CI action to make a new zip bundle on the Is there a way to force Spoon.install to fetch a new zip bundle? |
This may be a MacOS problem that can't be solved.
How to reproduce
Obviously it would be nice if it didn't change focus to the other monitor, but again, I think this is core MacOS problem.
The text was updated successfully, but these errors were encountered: