-
Notifications
You must be signed in to change notification settings - Fork 282
feat: change monitor focus with general.focus_follows_cursor
#959
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
feat: change monitor focus with general.focus_follows_cursor
#959
Conversation
10f08f0
to
fe38746
Compare
This causes some problems with the ShareX screenshot overlay. When you open it and move your cursor to another monitor it steals focus away from the overlay. This happens even tough the overlay spans all your monitors, and it should be detected by the window focusing code... Maybe the Windows API function for finding windows overlapping a point doesn't really work, and we should instead make our own implementation? Or maybe we should add a command to always keep a window focused? |
Just did a lil testing and ShareX is causing issues because it's ignored by the WM. Since ignored windows aren't part of the WM's tree of windows that it manages, What I'd suggest is we add a new state.is_focus_synced = match focused_container.as_window_container() {
Ok(window) => *window.native() == *native_window,
_ => Platform::desktop_window() == *native_window,
}; We could then return early in |
fe38746
to
bdd9704
Compare
80b01dc has some problems right now when moving the mouse between monitors and windows. I think the is_focus_synced field isn't being set to true in all the cases it should be. I will look into it. |
Put in a small fix commit for this just now - could you check if it's fully working on your end? Did some quick testing and it all seems to be behaving nicely now |
It seems to be working now, thanks for fixing! And sorry for taking so long to reply… You can merge it now. |
general.focus_follows_cursor
🎉 This PR is included in version 3.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 3.9.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This PR makes the general.focus_follows_cursor code focus the monitor that the cursor is on when there isn't a window to focus. This makes it so if you focus monitor 1, move your cursor to monitor 2 and open a program, the program will open on monitor 2 and not on monitor 1.
Before:
2025-02-02-T-13-51-11-explorer-z5LW7ZGThT.mp4
After:
2025-02-02-T-13-50-14-explorer-kKY2nnQe4m.mp4
This has been annoying me for a while, so I decided to fix it...
I don't know if it would've been better to make it focus the workspace under the cursor or not. Since there can only be one workspace displayed per monitor, I chose to make it focus the monitor.
Just let me know if you think it would be better to focus the workspace instead!