You should be able to do this with the `handleEventHook` [1], for which the `MotionEvent` [2] is the appropriate event to handle. You should be able to use `focus` [3] on the `Window` contained in the event to focus the window the mouse is currently over. Caveat emptor, this advice is entirely untested -- no idea what odd corners there are, or even whether it will work (e.g. I vaguely recall that xmonad used to ignore motion events in some circumstances; I don't see that in the code now but I wouldn't be surprised if it were still the case somehow).
~d