I like the "focus follows mouse" window-focussing model from X11, because
However MS-Windows follows the old-fashioned, Macintosh/Smalltalk style of having users click on a window to focus it for the keyboard. How do you make MS-Windows behave more like X11?
I used to install TweakUI from Microsoft, just so that I could turn on an X11-like focus-follows-mouse mode, but Microsoft don't make TweakUI for Vista (there is TweakVI instead, if you want to Google for it. It's by some other company. It's not bad, but overkill for what I want to do).
In Vista, Microsoft added a GUI for this mode that's almost what I want. You can do this:
Open Control Panel (new view, not Classic)
> Ease of Access Center
> Make the mouse easier to use
> [ ] Activate a window by hovering over it with the mouse
But this also brings the window to the front when it's focussed. If that's what you want, then you're done. If you're like me and you want the window under the mouse to have keyboard focus, but you don't want it brought to the front without clicking on it, you'll need to hack the Windows Registry. Here are some steps, which should be good for any release of Windows that is based on Windows NT (NT, 2000, XP, Vista, Win7):
0x0000001 (1)
df 3e 03 80 12 00 00 00
, then leave the 'df
' alone. If it's 9e 03 07 80 12 00 00 00
, change it to 9f .. ..
and so on *0x00000080
(128ms). You might like 200ms (c8
), or some faster or slower value.* If you can't do this hexadecimal bit twiddling math in your head (difficult if you're not a programmer), then Windows' Calc can do it for you: put it in Programmer and Hex modes, type the first byte (hex pair e.g. 9e), press the 'Or' button, then '1' and the '=' button. If the number changes, that's what you replace the first byte with. Thanks to Erik in the comments below, I've finally figured this out and (I hope) clarified what to do..
So, in summary, the Registry keys are as follows for X11-like window focus:
HKEY_CURRENT_USERS\Control Panel\Mouse REG_DWORD ActiveWindowTracking = 0x00000001 (1) HKEY_CURRENT_USERS\Control Panel\Desktop REG_DWORD ActiveWindTrkTimeout = 0x00000080 (128) REG_BINARY UserPreferencesMask OR= 01 .. .. .. .. .. .. .. ..
These registry hacks require a reboot to take effect.