Is there a way to set up "focus follows mouse" behavior in Unity?
13.04 and later (GUI)
Follow-on-focus settings can be set using the unity-tweak-tool
12.10 and later (command line)
The following controls follow-on focus
Use the value
Note: the difference between
In addition you have the following option which when set, automatically raises the window to have focus:
You can control the delay for this auto-raise capability (in milliseconds):
You can change
Two methods for 12.04 are presented below:
(see note below)
If do not have
In addition you have the following key which when set, automatically raises the window to have focus -
You can control the delay for this auto-raise capability (in milliseconds) by changing the key value
change windows focus mode to mouse or sloppy
(see note below)
"mouse" vs "sloppy"
A focus mode "sloppy" seems to work better at allowing Alt+TAB to override focus.
"mouse" means that if the mouse isn't in the window, the window isn't selected, no matter what you've selected in any other way.
Controlling What Window is on Top
The following window options control what window is in the front of others (or "on top"). It's slightly different than what window has the input focus. The following descriptions help explain slightly.
Some users who use focus-follows-mouse do not like the windows the interact with to come to the top unless they explicity click on the tilebar of the window. This gives a finer grain of control when working with multiple windows, but can be frustrating for most users.
Some users who use focus-follows-mouse, like to have the window their cursor is over automatically raise to the top. This makes the window in full view, with no other windows eclipsing it.
The length of time to wait before triggering the auto-raise behavior.
This can be done through CompizConfig Settings Manager. I've tested it on 11.10, 12.04, and 12.10, and a guest poster successfully tested it on 14.04.
Select the "Focus & Raise Behavior Tab", then uncheck "Click To Focus." Make sure "Auto-Raise" is checked.
If you don't have CompizConfig Settings Manager (also known as 'CCSM') installed, you can do so from the Software Center, or from the command line:
You can then launch it with as
Here are some general caveats for running ccsm: what are some of the issues with ccsm?
While you can use the gconf-editor or gnome-tweak-tool to do this, they are not installed by default. I also found (on the intarwebs from http://blog.bodhizazen.net/linux/gnome-3-focus-follows-mouse):
Personally, I don't like the auto_raise feature, so I set the second option to "false" and didn't set the auto_raise_delay option.
Note, however, that this ultimately "breaks" the Unified Menu Bar (UMB) (when you mouse off the item you're using and onto another one, the Unified Menu Bar is now reflective of whatever you're now hovering over).
Tested as recently as Precise
more edits: I've put "breaks" in quotes - yes, it's not really broken, but it breaks IMO the intent of the UMB, or at least makes it challenging to use as Reese correctly points out in the comment. IMO, that's a "breaks simple usability, but with an annoying workaround." Though given Linux's focus on providing very strong multitasking (which tends to lead to a "cluttered" desktop), it seems that either the UMB diminishes multitasking, or multitasking diminishes the UMB's capabilities. I'll leave that as an exercise to the reader to decide...
Another way to enable focus-follows-mouse worked for me in a recent 12.10 install. There is currently a bug in 12.10 (and a special shout-out to nealmcb for the link) that causes changes made with ccsm or gsettings to revert on logout or reboot. I tried a couple different ways of tricking the bug, but eventually had success with this post about using Unsettings.
In case that page migrates away, the process boils down to:
Start up unsettings, go to the Windows tab, and turn off Click to Focus. I rebooted to get it to "take", but probably only needed to log out and back in again.
For future reference, it sounds like this bugfix will be available shortly, so the normal methods of CCSM or gsettings should go back to working correctly.
protected by Community♦ Mar 31 '12 at 20:26
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?