On your Mac, choose Apple menu > System Preferences, then click Notifications & Focus . Click Focus, then select a Focus. In the Turn On Automatically list, click the Add button , then choose whether to schedule the Focus based on time, location, or app.
Focus is a tool designed for your Mac that allows you to instantly block off all online and offline distractions of your choice on your computer.
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).
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.
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.
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.
I've been coming back to this question periodically for about 10 years and I finally found a simple solution: AutoRaise https://github.com/sbmpost/AutoRaise
By default it enables focus-follows-mouse AND autoraise. You can delay the autoraise with a config option.
It also has what they call "warp" function that centers the mouse pointer in a window when you Command-Tab to the window. I never knew I needed this until I tried it, but once I tried it, I can't live without it!
So I decided to improve again on the work I did on the MouseFocus.app which still had some flaws. Those are fixed now. I renamed the whole thing to "AutoRaise" to better reflect what this tool does: When you hover a window it will be raised to the front (with a delay of your choosing) and gets the focus. The tool can be downloaded here. To use it, copy it to your /Applications/ folder making sure it is executable (chmod 700 AutoRaise). Then double click it from within Finder. To quickly toggle it on/off you can use the applescript below and paste it into an automator service workflow. Then bind the created service to a keyboard shortcut via System Preferences|Keyboard|Shortcuts.
Update (29-03-2017): The AutoRaise binary has been updated. If no delay has been specified on the command line, it will now also look for an AutoRaise.delay file in the same home folder. This is particularly useful when using the applescript below because 'launch application' does not support command line arguments. The delay should be specified in units of 50ms 20ms. For example to specify a delay of 20ms run this command once in a terminal: 'echo 1 > ~/AutoRaise.delay'
on run {input, parameters}
tell application "Finder"
if exists of application process "AutoRaise" then
quit application "/Applications/AutoRaise"
display notification "AutoRaise Stopped"
else
launch application "/Applications/AutoRaise"
display notification "AutoRaise Started"
end if
end tell
return input
end run
Update (18-04-2019): The source https://github.com/sbmpost/AutoRaise
Update (05-06-2020): The default delay has been set to 2 and polling time was reduced. These settings prevent unintended window raising when moving the mouse quickly (to reach the top menu for instance). Also a warp mouse feature has been added and a memory leak has been fixed. For further details check out the README
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With