Focus-follows-mouse (plus auto-raise) on Mac OS X

Focus-follows-mouse is not a particularly suitable input method for OS X because its menu bar was designed to be at the top of the screen. When you move the mouse out of your application window to get to the menus, if it crosses any other application's windows on the way, the menu changes.

So yes, in reply to dreeves comment, it works perfectly fine for Terminal (or for any other single application on the desktop), because the only other windows it's going to affect are Terminal windows, so the menu never changes as you switch windows. And it works fine for X11 because X11 apps generally have their menu bars embedded in the window, so you don't have to leave the window to access them.

Of course you can work around the menu-changing issue by introducing an artificial delay before the focus changes and/or the menu switches, but it's never going to work as well as it does on other desktops.


Although this is far from a complete solution, two handy actions that are built into OSX (10.11) are:

⌃⌥-click (control-option-click) - switches focus without raising window

⌘-click (command-click) - clicks in window without switching focus

Not sure when these shortcuts were introduced, as I haven't been able to find them written about anywhere.


Steve Yegge wrote an essay about this a while back, where he tried and failed to write a suitable extension. I've since tried to find focus-follows-mouse applications for OS X and failed also.


You can do it for Terminal.app by issuing the following command at the command line:

defaults write com.apple.Terminal FocusFollowsMouse -bool true

For X11 apps you can do this:

defaults write com.apple.x11 wm_ffm -bool true

In Snow Leopard, use this instead:

defaults write org.x.X11 wm_ffm -bool true

Apparently there's a program called CodeTek Virtual Desktop that'll emulate it systemwide, but it costs $$ (and they never got a version out for OSX Leopard).

Tags:

Macos

Mouse

Focus