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:

AIs as Humanity's Children

in which I have opinions about AI

via Thing of Things January 22, 2025

2024-25 New Year review

This is an annual post reviewing the last year and setting intentions for next year. I look over different life areas (work, health, parenting, effectiveness, travel, etc) and analyze my life tracking data. Overall this was a pretty good year. Highlights …

via Victoria Krakovna January 15, 2025

The ugly sides of two approaches to charity

What's neglected by "magnificent" philanthropy, and by Singerian global poverty focus The post The ugly sides of two approaches to charity appeared first on Otherwise.

via Otherwise January 13, 2025

more     (via openring)