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:

Starting With Chords

A lot of people play fiddle. Basically nobody starts by learning chords before learning melodies. But that's actually how I learned. I started with chords. One of the nice things about learning to play violin this way is that you can go busking even…

via Anna Wise's Blog Posts November 15, 2024

Stuffies

I have some stuffies and I just have a bunny. Bunny is a rabbit. Woof is a seal. My favorite stuffie is bun bun. I play with my stuffies. Sometimes I jump up with them and I roll them. I can just throw them in the air when I want to play bthululubp wi…

via Nora Wise's Blog Posts November 15, 2024

You Can Buy A Malaria Net

2024 election takes

via Thing of Things November 6, 2024

more     (via openring)