More restricted version of XMonad.Actions.UpdatePointer

Right now I use updatePointer to move the pointer to the focused window. The main scenario where I want this is when I'm switching between windows with the keyboard and then decide to use the mouse for something - it can then be surprising that the mouse pointer is in a window without keyboard focus and that I need to move it out and back in again to get it back. However, there are various situations where it triggers when I don't want it, especially with applications that try to be clever with lots of small floating windows. I would quite like to restrict it only to trigger when I issue a MOD+J or MOD+K command to xmonad. Is that possible? Perhaps I can just rebind those keys in some way to roll in the pointer moving behaviour, and not bother with updatePointer?

On Fri, Mar 11, 2011 at 9:56 PM, Weeble
Right now I use updatePointer to move the pointer to the focused window. The main scenario where I want this is when I'm switching between windows with the keyboard and then decide to use the mouse for something - it can then be surprising that the mouse pointer is in a window without keyboard focus and that I need to move it out and back in again to get it back. However, there are various situations where it triggers when I don't want it, especially with applications that try to be clever with lots of small floating windows. I would quite like to restrict it only to trigger when I issue a MOD+J or MOD+K command to xmonad. Is that possible? Perhaps I can just rebind those keys in some way to roll in the pointer moving behaviour, and not bother with updatePointer?
Weeble, That's exactly the right idea. You could bind to M-j, M-k like that in this config: import qualified XMonad.StackSet as W; import XMonad import XMonad.Actions.UpdatePointer import XMonad.Util.EZConfig up = updatePointer $ TowardsCentre 0.2 0.2 main = xmonad $ defaultConfig `additionalKeysP` [("M-j", do windows W.focusDown; up), ("M-k", do windows W.focusUp; up)] Adam

On Sun, Mar 13, 2011 at 6:18 PM, adam vogt
That's exactly the right idea. You could bind to M-j, M-k like that in this config: [...] up = updatePointer $ TowardsCentre 0.2 0.2
main = xmonad $ defaultConfig `additionalKeysP` [("M-j", do windows W.focusDown; up), ("M-k", do windows W.focusUp; up)]
Thanks, that's great!
participants (2)
-
adam vogt
-
Weeble