xmonad-contrib-0.17.1: Community-maintained extensions for xmonad

Copyright | (c) Daniel Schoepe
License | BSD3-style (see LICENSE)
Maintainer | Daniel Schoepe <asgaroth_@gmx.de>
Stability | unstable
Portability | unportable
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Actions.UpdateFocus

Contents

- Usage

Description

Updates the focus on mouse move in unfocused windows.

Synopsis

- focusOnMouseMove :: Event -> X All
- adjustEventInput :: X ()
- focusUnderPointer :: X ()

# Usage

To make the focus update on mouse movement within an unfocused window, add the following to your `~/.xmonad/xmonad.hs`:

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

This module is probably only useful when focusFollowsMouse is set to True(default).

focusOnMouseMove :: Event -> X All #

Changes the focus if the mouse is moved within an unfocused window.

adjustEventInput :: X () #

Adjusts the event mask to pick up pointer movements.

focusUnderPointer :: X () #

Focus the window under the mouse pointer, unless we're currently changing focus with the mouse or dragging. This is the inverse to XMonad.Actions.UpdatePointer: instead of moving the mouse pointer to match the focus, we change the focus to match the mouse pointer.

This is meant to be used together with `updatePointer` in individual key bindings. Bindings that change focus should invoke `updatePointer` at the end, bindings that switch workspaces or change layouts should call `focusUnderPointer` at the end. Neither should go to `logHook`, as that would override the other.

This is more finicky to set up than `focusOnMouseMove`, but ensures that focus is updated immediately, without having to touch the mouse.