xmonad-contrib icon indicating copy to clipboard operation
xmonad-contrib copied to clipboard

XMonad.Actions.UpdateFocus doesn’t work

Open texttheater opened this issue 8 years ago • 10 comments

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

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.

texttheater avatar Sep 02 '17 09:09 texttheater

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...).

geekosaur avatar Sep 11 '17 09:09 geekosaur

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.

texttheater avatar Sep 11 '17 10:09 texttheater

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.

presto8 avatar Aug 10 '21 17:08 presto8

Same issue with me, I hover the mouse over an unfocused window and it does not get focused.

yusi1 avatar Sep 03 '21 20:09 yusi1

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...

ixzh avatar Oct 28 '21 16:10 ixzh

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

slotThe avatar Oct 28 '21 19:10 slotThe

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.

ixzh avatar Oct 28 '21 23:10 ixzh

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?

slotThe avatar Nov 13 '21 08:11 slotThe

I can't think of anything; unless the clientMask is not being applied properly for some reason, it should work.

geekosaur avatar Nov 13 '21 20:11 geekosaur

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.

geekosaur avatar Nov 15 '21 11:11 geekosaur