xmonad: focus window when mouse is moved

3

2

In my xmonad config, I have set focusFollowsMouse=true so that a window is focused when the mouse pointer is moved onto it. However, I would also like a window to become focused when the mouse pointer is already on it, and it is moved.

Steps to reproduce:

  1. Move the mouse pointer over some window.
  2. Focus a different window using the keyboard, e.g. by Mod+Tab or selecting a different screen.
  3. Move the mouse pointer slightly, so that it stays on the same window.

Desired behavior:

The window becomes focused again.

Actual behavior:

Focus does not change.

Is there any way I can achieve the desired behavior?

ke.

Posted 2016-05-11T10:45:41.097

Reputation: 31

Answers

0

Looks like this can be done with: https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Actions-UpdateFocus.html

To enable it you need to add the focusOnMouseMove event handler:

import XMonad.Actions.UpdateFocus
xmonad $ def {
  ..
  startupHook = adjustEventInput
  handleEventHook = focusOnMouseMove
  ..
}

Chris Stryczynski

Posted 2016-05-11T10:45:41.097

Reputation: 121

An answer cannot be just a link, it has to stand on its own, for instance by summarizing the page linked. – xenoid – 2017-08-29T13:35:18.127

Thanks! From the description it sounds like just the thing. I tried it but unfortunately no effect. Will check back if I get it to work. – ke. – 2017-09-01T20:42:49.587

Filed bug report: https://github.com/xmonad/xmonad-contrib/issues/210

– ke. – 2017-09-09T14:59:11.757