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

feature request: focus_follows_mouse doesn't work across OS windows #754

Closed
jordanlewis opened this issue Jul 29, 2018 · 4 comments
Closed

Comments

@jordanlewis
Copy link

Thanks for the great work on Kitty!

It seems like focus_follows_mouse works across Kitty split windows within a single OS window, but not across multiple Kitty OS windows. It would be really great if that would work as well, as coming from iTerm 2 I'm used to that behavior.

Any chance that's possible to implement?

@kovidgoyal
Copy link
Owner

As far as I know that requires support from the OS. It is the job of the OS window manager to implement focus follows mouse for OS windows, not individual applications, otherwise you end up in the situation where focus follows mouse for some windows and not others. I dont know if macOS has a setting for it or some hack you can do to enable it. Or use a non-Apple sanctioned window manager, such as chunkwm.

As for item2 supporting it, it presumably uses some cocoa specific/hidden api to implement it. It may be possible to do the same in kitty, since kitty has access to the underlying coca window object, so patches are welcome, if you know how to implement it. Relevant code in in kitty/cocoa_window.m and glfw.c

@jordanlewis
Copy link
Author

jordanlewis commented Jul 29, 2018

It's pretty simple actually, no hidden OS support required. I would send a PR but I'm not sure how to plumb the options into cocoa_window.m, maybe you know. Here's the diff for focus follows mouse where the moused-over window gets all keystrokes:

 - (void)mouseEntered:(NSEvent *)event
 {
     if (window->cursorMode == GLFW_CURSOR_HIDDEN)
         hideCursor(window);
 
+    [[self window] makeKeyWindow];
+
     _glfwInputCursorEnter(window, GLFW_TRUE);
 }

You can make the moused over window pop to the front too, with [[self window] orderFrontRegardless] in case that's something people care about. I'd only really care about changing where the keystrokes go to.

The hidden API stuff is important if you want the focus follows mouse behavior even when kitty isn't the frontmost app. But this is useful even without that part.

@kovidgoyal
Copy link
Owner

Send a PR implementing it unconditionally, and I will take care of gating it behind an option.

@jordanlewis
Copy link
Author

#772

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

2 participants