Tuesday, June 23, 2009

Focus-Follows-Mouse in Windows

There is a very simple change in Windows to enable natively-supported functionality of focus-follows-mouse. This is similar to default functionality in most desktop managers in Linux (or X-Window system).


Believe it or not, Windows does support focus-follows-mouse, though there is no GUI configuration exposing it. Instead you must edit a registry key and then log out and back in for the change to become effective. You can use regedit to edit the key.

On Windows NT, set the following registry key to have a value of 1:
HKEY_CURRENT_USER\Control Panel\Mouse\Active Windows
On NT it has some bugs: some apps auto-raise on focus, and alt-tab doesn't move the mouse.

On Windows 2000, XP, or 2003, you need to change a binary-valued registry key:
This is a little-endian bitmask. For focus-follows-mouse, add the flag 0x1. For example, my XP SP2 laptop originally had a value of 9E 3E 05 80, which is 0x80053E9E. To activate focus-follows-mouse I changed to 0x80053E9F, or 9F 3E 05 80 in regedit.

According to you can also achieve raise-on-focus by adding the flag 0x40. I haven't tested that as I don't like raise-on-focus."
Source: Making Windows Usable
So, it is the first number that gets increased by 1 in regedit.


Menno Smits said...

The TweakUI PowerToy from Microsoft also allows you to enable this - without the manual registry hacking.

Also check out TXMouse for an even more authentic implementation. This adds X-like copy and paste with mouse as well as focus-follows-mouse.

Anonymous said...

I know this is old but it is awesome. Thanks for posting.