Focus Follows Mouse on OSX: A Weird Quirk

April 6th, 2011
focus, mouse, osx, tech
When I first started using a mac, the lack of focus-follows-mouse [1] really bugged me. I looked into changing it, saw that steve yegge had determined it was pretty much impossible to change, figured out how to turn it on for terminal and x11, and stopped there. People suggested that if it bugged me this much I should just spend all my time in x11, but I wasn't unhappy enough to switch.

Recently, though, I noticed something strange: focus will follow the mouse into terminal almost all the time. Supposedly, the way focus follows mouse works for terminal (and x11) is that within one application you can do whatever you want with your keystrokes and the multiple windows of terminal or x11 are all running as one application. So if I have terminal up I can type into any terminal windows just by moving the mouse. I shouldn't be able to go from typing an email to typing in terminal; that's supposed to be impossible.

What I see instead is that whatever program I have focused, if I move the mouse into terminal then type, that typing shows up. This includes proper handling of the shift and control keys, but command is a little weird (command-N opens a new window correctly, command-T opens a new window instead of a new tab, command-V does nothing). This appears to work all the time except when the previously focused window is on a different physical screen than the terminal.

This indicates that there's something terminal is doing that's different than what steve yegge tried, because he found:

I start my little app (which has no UI), move the mouse into a window from a non-foreground application, and I can type into it!

Except I can only type unmodified keys. It's completely ignoring my keyboard event posts for Shift, Control, Alt and Command. That's the lie part. They said they'd generate flags changed events. They lied.

So maybe there's still hope for focus follows mouse on mac osx? How does terminal do it?

[1] This is where you choose which window your typing goes into by putting the mouse over that window. To switch from typing in firefox to typing in my email client, I'd just need to slide the mouse over. Both windows and mac by default make you click to choose the window, which is usually called click-to-focus.

Comment via: facebook

Recent posts on blogs I like:

The Grimke Sisters and Sexism

The necessity of birth control

via Thing of Things April 22, 2024

Clarendon Postmortem

I posted a postmortem of a community I worked to help build, Clarendon, in Cambridge MA, over at Supernuclear.

via Home March 19, 2024

How web bloat impacts users with slow devices

In 2017, we looked at how web bloat affects users with slow connections. Even in the U.S., many users didn't have broadband speeds, making much of the web difficult to use. It's still the case that many users don't have broadband speeds, both …

via Posts on March 16, 2024

more     (via openring)