Focus Follows Mouse or Sloppy Focus on Mac OS X

21

8

"Focus follows mouse" or "sloppy focus" is a feature common to X11 window managers on Linux/Unix, including GNOME, KDE, CDE, XFCE and window managers like Enlightenment, Fluxbox and Window Maker. It is also available via TweakUI on Windows. Some individual applications on OS X, like iTerm support it.

What is it? Simply put, the window where the mouse pointer is has focus, rather than having to click a window for it to gain focus.

Does the native GUI for OS X support this, with some hidden setting?

jtimberman

Posted 2009-08-21T16:44:13.967

Reputation: 20 109

In case someone is wondering the same thing as @BenjaminDobson and, one of the biggest things this allows is to decouple the window focus and the window raise (putting it on top). It may seem strange, but once you are used to it, the ability to type in a window that isn't "on top" is huge. If part of the window with which you are interacting can be covered by a window displaying information to which you are actively referring, it allows dramatically fewer clicks, movements, and keyboard-mouse-keyboard switches for many common tasks. – derekv – 2016-02-10T15:30:43.643

Why do you want this? (I know that sounds a bit mean, but I'm curious.) – Benjamin Dobson – 2009-08-21T18:30:40.617

9Its a feature of X11 I've used for many (~15) years on Linux systems, and its nice to just bump the mouse over to another window. – jtimberman – 2009-08-21T18:52:22.820

Eewwh! Your business, of course, but first thing I do on setting up a new (to me) WM in X is find the click-to-focus option. – dmckee --- ex-moderator kitten – 2009-08-22T01:06:06.543

Answers

8

The fundamental problem with sloppy focus on the Mac is that the menu bar is always associated with the currently focused application; if you had sloppy focus, accessing the menu bar for a specific application would be supremely difficult.

Having said that, Zooom/2 does what you want, in addition to providing equivalents to the open-source window manager features for ctrl+click moving & resizing of windows.

Drew Stephens

Posted 2009-08-21T16:44:13.967

Reputation: 553

It wouldn't be 'supremely difficult', just maybe a bit confusing until you get used to it. – andz – 2015-08-12T03:14:19.520

1Almost every request of of focus-follow-mouse is met with an answer of auto-raise. This one is no exception. And it is really unfortunate that this answer is chosen as the best answer. I would quote Steve Yegge's blog: "I, for one, think of autoraise as a big, stinky, deceased buffalo carcass that someone thoughtfully dragged into my living room while I was on vacation, probably towards the beginning of the vacation, and then they turned up my thermostat to 110°F, closed the windows and tossed a Durian fruit at the wall for good measure." – some user – 2015-10-06T19:23:29.443

@some-user I agree. Fortunately John Siracusa has an answer here that works for Terminal and iTerm/iTerm2, which for many (including me) is enough to be productive. – kmarsh – 2015-12-22T16:12:52.787

For sloppy focus to work properly wothout auto raising, you need menu bar inside the window frame. Or use sloppy focus only between windows of the same app (as iTerm does). It's true that Ubuntu lets you use sloppy focus, but you can also set it to put menu inside the window, there's no problem. – gerlos – 2016-05-20T11:46:59.943

Zooom/2 looks pretty sweet! – jtimberman – 2009-08-21T17:28:05.220

3The focus follows mouse is nice, and the keyboard shortcut part is interesting, but I'd like something that didn't autoraise :/. – jtimberman – 2009-08-21T17:49:07.910

I'm not sure whether Zooom/2 is still actively developed, but you might toss them an email; it looks like that could be a simple change to their settings pane. I bought Zooom/2 a few years ago after switching from Linux to Mac because I'm addicted to ctrl+click move & resize. – Drew Stephens – 2009-08-21T18:06:15.503

I think the first aspect of this answer is oft-misunderstood. With FFM, then it would be hard to use the menus of any app that isn't "touching" the menubar. – Matthew Schinckel – 2009-08-22T11:13:47.883

2Zooom/2 only raises (and focuses) a window after a delay. – Drew Stephens – 2009-08-23T08:32:09.923

Accepting this answer as Zooom/2 is not only fantastic in bringing the cmd-click window movement, but the shortcut+mouse movement to focus is a nice compromise for now. Thanks! :D – jtimberman – 2009-08-23T16:28:26.883

6Somehow Ubuntu Unity manages to enable focus-follows-mouse or "sloppy focus" with a single menu bar. Shame Apple can't. – Jason R. Coombs – 2012-03-29T17:45:32.887

9As the other comments say, Zooom/2 does not actually implement FFM or sloppy focus. It is limited to autoraising windows, which is a very different thing.

Sadly, it seems that for the time being there is no good way to do this in OS X. As @andz responded, Steve Yegge has a good writeup on this, as well as sample code you can use to achieve a limited version of "sloppy focus" (limited in that modifier keys do not work). – pix0r – 2009-12-02T23:28:06.487

1Shouldn’t sloppy focus work just fine with the menu bar? If the user only needs to coast the mouse over the desktop to get from the window to the menu bar, the original window should still be focused and the menu bar unchanged… – binki – 2014-01-02T17:14:58.657

13

The standard Terminal application included in Mac OS X will do focus-follows-mouse (within that application only, and no auto-raise) if you run this command from a shell and then restart the Terminal app:

% defaults write com.apple.Terminal FocusFollowsMouse -boolean YES

John Siracusa

Posted 2009-08-21T16:44:13.967

Reputation: 1 197

@jtimberman Thank you! On iTerm2 Build 2.1.4 I activated it by going to Profiles->Open Profiles (pick a proflle and) Edit Profiles... Point Tab, Miscellaneous Settings check Focus Follows Mouse. Since this is restricted to iTerm only it doesn't mess up the other Apple-ey parts of the UI, and I get to type into terminal window that's not on top. Yeah! – kmarsh – 2015-12-22T16:04:03.843

5Yes, and I use iTerm.app instead of Terminal.app (other reasons), which does the same. I want FocusFollowsMouse for all applications, not just terminals. – jtimberman – 2009-08-21T23:32:39.963

7

@Drew

The fundamental problem with sloppy focus on the Mac is that the menu bar is always associated with the currently focused application; if you had sloppy focus, accessing the menu bar for a specific application would be supremely difficult.

The menu bar wouldn't have to be changed though, just like you wouldn't have to enable auto-raise.

Having said that, Zooom/2 does what you want ...

But as was mentioned in the comments: not without auto-raise, which just makes it unusable. Another caveat is that it activates Finder whenever you move the mouse over the desktop, so you'll pretty much have to add Finder to the ignore list. Both of these issues apply for MondoMouse too.

It wasn't mentioned here yet, but OS X has click-through — if you hold , it's possible to click most items in background windows.

Lri

Posted 2009-08-21T16:44:13.967

Reputation: 34 501

Please note that Drew will not get notified of your reply. You should start commenting on others' posts if you want to reply to them. – Daniel Beck – 2011-03-12T16:19:17.613

@Daniel I didn't really mean to address this answer as a reply to him, I just thought the block quote would've seemed out of place without the username. But it would indeed be better to clearly separate answers from comments, and quote other answers sparingly. I also did think that other answerers can be notified. The meta thread about @replies doesn't state it very clearly. – Lri – 2011-03-12T18:13:11.357

7

Steve Yegge over at his blog claims that focus follow mouse with no autoraise isn't going to happen on OS X anytime soon:

http://steve-yegge.blogspot.com/2008/04/settling-osx-focus-follows-mouse-debate.html

Since ALL OS X utilities out there that promise "focus follows mouse" do autoraise, I think Steve Yegge is sadly right.

andz

Posted 2009-08-21T16:44:13.967

Reputation: 191

4

It should be noted that Leopard introduced "Scrolling Focus Follows Mouse," where you can scroll via the mouse scroll wheel or a trackpad gesture on any window that the mouse is over.

Except, of course, Microsoft Word for Mac.

This is a great feature that, while not full Focus-Follows-Mouse, proves that some aspects of it can be done in OS X.

ck_

Posted 2009-08-21T16:44:13.967

Reputation: 353

3

There should be no problem with doing focus-follows-mouse without autoraise across all applications, as the Terminal example and command-click prove, but you'd need to inject code into running applications via mach_inject or similar. You'd essentially write an "input manager" that redirects the keystrokes/clicks any time the mouse enters a textbox/button. Any click that doesn't hit a button raises the window. And command-click only raises the window.

Jeff Burdges

Posted 2009-08-21T16:44:13.967

Reputation: 191