xmonad-contrib-0.18.0.9: Community-maintained extensions for xmonad
Copyright(c) Daniel Schoepe
LicenseBSD3-style (see LICENSE)
MaintainerDaniel Schoepe <asgaroth_@gmx.de>
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Actions.UpdateFocus

Contents

Description

Updates the focus on mouse move in unfocused windows.

Synopsis

Usage

To make the focus update on mouse movement within an unfocused window, add the following to your 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 Source #

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

adjustEventInput :: X () Source #

Adjusts the event mask to pick up pointer movements.

focusUnderPointer :: X () Source #

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.