35

"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?

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
jtimberman
  • 21,597
  • 12
  • 68
  • 77
  • 1
    Why do you want this? (I know that sounds a bit mean, but I'm curious.) – Benjamin Dobson Aug 21 '09 at 18:30
  • 13
    Its 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 Aug 21 '09 at 18:52
  • 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 Aug 22 '09 at 01:06
  • 5
    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 Feb 10 '16 at 15:30
  • related: https://stackoverflow.com/a/98331/127971 also see answer below about enabling this feature specifically (and only) for terminal https://superuser.com/a/27545/73961 – michael Jan 05 '23 at 12:49
  • It also really helps when you're using multiple monitors. – Harlin Jan 26 '23 at 14:34
  • IMHO the key for `focus-follows-mouse` is to separate it from auto-raising. Instead using a key to `raise-or-lower-window`. There used to be a project to replace the OSX windows manager that could do all this: "CodeTek Virtual Desktop Pro", but it miraculously disappeared in the early 2000's. It basically behaved like FVWM. – Tilo Apr 19 '23 at 14:40

7 Answers7

20

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
  • 1,277
  • 2
  • 10
  • 10
  • 7
    Yes, 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 Aug 21 '09 at 23:32
  • 1
    @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 Dec 22 '15 at 16:04
11

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
  • 591
  • 6
  • 12
  • Zooom/2 looks pretty sweet! – jtimberman Aug 21 '09 at 17:28
  • 3
    The focus follows mouse is nice, and the keyboard shortcut part is interesting, but I'd like something that didn't autoraise :/. – jtimberman Aug 21 '09 at 17:49
  • 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 Aug 21 '09 at 18:06
  • 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 Aug 22 '09 at 11:13
  • 3
    Zooom/2 only raises (and focuses) a window after a delay. – Drew Stephens Aug 23 '09 at 08:32
  • 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 Aug 23 '09 at 16:28
  • 12
    As 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 Dec 02 '09 at 23:28
  • 8
    Somehow Ubuntu Unity manages to enable focus-follows-mouse or "sloppy focus" with a single menu bar. Shame Apple can't. – Jason R. Coombs Mar 29 '12 at 17:45
  • 1
    Shouldn’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 Jan 02 '14 at 17:14
  • It wouldn't be 'supremely difficult', just maybe a bit confusing until you get used to it. – andz Aug 12 '15 at 03:14
  • 2
    Almost 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 Oct 06 '15 at 19:23
  • @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 Dec 22 '15 at 16:12
  • 1
    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 May 20 '16 at 11:46
8

@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
  • 40,894
  • 7
  • 119
  • 157
  • 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 Mar 12 '11 at 16:19
  • @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 Mar 12 '11 at 18:13
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
  • 201
  • 2
  • 6
5

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_
  • 363
  • 1
  • 4
  • 8
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
  • 201
  • 1
  • 6
0

The free, open-source Amethyst Mac app is an alternative to Zooom and Mondomouse (Whose links above seem to be broken).

You can download Amethyst here: https://github.com/ianyh/Amethyst

user2544542
  • 121
  • 1
  • 5