XMonad.Actions.UpdateFocus doesn’t work
Problem Description
I’m using Xmonad.Actions.UpdateFocus as per its documentation.
Expected behavior: when the mouse cursor is over an unfocused window and the mouse is moved, the window becomes focused.
Actual behavior: the above does not happen.
Configuration File
import XMonad
import XMonad.Actions.UpdateFocus
main = xmonad $ defaultConfig {
focusFollowsMouse = True,
startupHook = adjustEventInput,
handleEventHook = focusOnMouseMove
}
Checklist
-
[✔] I've read CONTRIBUTING.md
-
[ ] I tested my configuration with xmonad-testing
Currently using xmonad installed from Ubuntu 16.04 repository.
Additional information
Brandon Allbery writes:
I'd have to review xmonad's setup code to be certain, but I think the startupHook no longer works. Instead, the mask changes it makes need to be exported and applied to the rootMask and clientMask fields of the XConfig.
So, as a temporary measure, you can replace the startupHook setting with the following XConfig fields:
, rootMask = rootMask def .|. pointerMotionMask
, clientMask = clientMask def .|. pointerMotionMask
This may not be complete, someone in #xmonad is reporting this is not sufficient to make it work. I still have not had a chance to review the actual pointer checking code (and am rather short on sleep of late...).
So that gives me the following minimal example configuration:
import XMonad
import XMonad.Actions.UpdateFocus
main = xmonad $ defaultConfig {
focusFollowsMouse = True,
rootMask = rootMask def .|. pointerMotionMask,
clientMask = clientMask def .|. pointerMotionMask,
handleEventHook = focusOnMouseMove
}
It compiles, but the behavior remains unchanged.
Sorry to bump this old issue, but I am running into the exact same issue as well and it does not appear fixed. I tried both methods suggested above. I have a dual monitor configuration.
If the focus is currently on the right monitor, and I use the keyboard to change the focus to the left monitor, but then move my eyes back to the right monitor and move the mouse, it would be nice to have the focus change back to where the mouse is.
Same issue with me, I hover the mouse over an unfocused window and it does not get focused.
hmmm this is not resolved I suppose? I seemed to have focusOnMouseMove work for a while in version 0.16.9999 and recently found it stopped working...
I'm having trouble seeing how this would have ever worked in the first place; events aren't passed through to child windows (right?) and the selectInput in adjustInputEvent only counts for the root window so...?
The fact that it doesn't work if we add pointerMotionMask to the clientMask is a bit surprising, though
It happened a few times which was unwanted so that I commented out the adjustInputEvent hook. I came to this issue only after I wanted to reenable this feature.
maybe I remembered wrongly or I clicked the mouse somehow to get the focus. It was not working from the beginning.
I played around with this a bit and it seems that even with pointerMotionMask the core only gets MotionEvents for the root window. Once we are below any child window there is radio silence. This seems quite surprising to me; @geekosaur is there anything in the way X11 works that would cause this? Is this intended behaviour even?
I can't think of anything; unless the clientMask is not being applied properly for some reason, it should work.
Now that I've thought about it a bit, we found a similar behavior in a small program intended to add a "fake" frame window to try to work around programs that break in a non-reparenting window manager: the reparented window stopped receiving MotionEvents.. This makes me think there was a change in X11, since there was nothing in the program preventing them from being passed on and obviously the program with the reparented window didn't change.