-
Notifications
You must be signed in to change notification settings - Fork 46
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
don't lose focus when focus follows mouse is enabled #107
Comments
Just tried to add "re focus" the window after it was moved but with "focus follows mouse" the focus immediately jumps 'back'. |
conceptually, it is possible to have the mouse pointer outside the window, even with focus follows mouse, since that's what happens when alt-tab is used. perhaps something else (order of events?) cause the "jump back" behaviour? otherwise, moving the mouse pointer within the new bounds would be perfectly acceptable. the window moves on the screen, so the pointer needs repositioning anyway before it can be used in a meaningful way. moving it inside the new bounds would even reduce the travel distance. |
First of all, you are absolutely right this is really annoying when follow mouse is enabled. I tried multiple ways to (re-)focus the moved window (Main.activateWindow, MetaWindow.focus, MetaWindow.activate). All of them can be used to change focus a window. At least using looking glass. MetaWindow has a number of events (signals) including position-changed and size-changed. Unfortunately it seems to be to early to re-focus the moved window inside this event listeners. There is no "unfocus" signal which would be the easiest way. The pnly remaining option I can think about is kind of a delay call inside the event listener of the resize/move event. Maybe @73 can help us here. He developed the "move focus" feature. |
so did you try the hacky way: a timeout function that refocuses after 0.1 second? 😞 |
what about https://github.com/negesti/gnome-shell-extensions-negesti/blob/develop/moveFocus.js#L161-L166 |
@wbolster are you still using the extension? if not i will close this issue |
yes i still use it. and why would you close it? it has not been resolved after all. better to leave issues open and visible for others to avoid duplicates or even encourage contributors... |
Thanks for your feedback. I just wanted to know, if someone is using the extension with focus follows mouse. The bug is not really easy to fix. |
I'm also using focus follows mouse and unfortunately this extension doesn't play nice with it. I have a suggestion for a workaround. Instead of trying to keep the focus on the window that was moved, record the last position of the If the last position of the mouse hasn't changed since this extension was used to change a window, Therefore we can simply ignore the change in focus and thus this extension can simply continue to operate on the same window until the cursor position has changed. |
Changes of focus induced by another user interaction such as some key combination like alt tab would also have to be taken into account by this workaround to be consistent. |
In the mean time I found a hack, that solves the problem, if you can live with the mouse You need to have xdotool installed. This will only work on X. Put the following line in the top of extension.js: const Util = imports.misc.util; Put the following line as the last line of _resize: function, which should Put the following line as the second to last line of _moveToCornerKeepSize: function, before the return line, which is approximately line 560: Maybe someone can turn this into an option in the preference dialog. |
would it be possible to force the window that i just moved to keep focus?
right now, when i move a window using a keyboard shortcut, and the window resizes in such a way that the mouse cursor is no longer inside the window's frame, the window loses focus. i assume this happens because i use "focus follows mouse".
this is annoying, since i now need to switch (super-tab) back to the window that i just moved (and which already had focus), depending on the mouse position (which i usually don't know since i was using the keyboard).
The text was updated successfully, but these errors were encountered: