Search code examples
haskellintellij-ideamousexmonad

Xmonad - How do I move mouse pointer as part of ManageHook?


Given this sample myManageHook. How can I call UpdatePointer after doIgnore? All my tries resulted in type incompatibilities.

myManageHook = composeAll . concat $
    [
      -- IntelliJ idea Tweaks
      -- Manage idea completion window
      , [ appName =? "sun-awt-X11-XWindowPeer" <&&> className =? "jetbrains-idea" --> doIgnore ]
      , [ (className ~=? "jetbrains-") <&&> (title ~=? "Changes in") -->  unfloat ]
    ]
    where
      unfloat = ask >>= doF . W.sink

My problem is that IntelliJ Idea popup window loses focus during typing if my mouse pointer is located over suggestions dropbox. That's why I'm trying to move the mouse to an upper part of the screen when this window appears.

enter image description here

UPD Found related thread with workarounds for Idea https://youtrack.jetbrains.com/issue/IDEA-112015#comment=27-2362253


Solution

  • You can use liftX to turn an X action into a Query action. You probably want to use XMonad.Actions.Warp instead of X.A.UpdatePointer instead, though; the latter looks like it might do a bit too much magic to sensibly fire during a manage hook. Anyway you should be able to try that out yourself once you see how to lift X actions.

    So, for banish, you could use liftX like this:

    ... --> (liftX (banish UpperLeft) >> doIgnore)
    

    Other X actions can be lifted and sequenced with doIgnore similarly.