xmonad-contrib-0.18.1: Community-maintained extensions for xmonad
Copyright(c) 2024 Tomáš Janoušek <tomi@nomi.cz>
LicenseBSD3
MaintainerTomáš Janoušek <tomi@nomi.cz>
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Hooks.FloatConfigureReq

Description

xmonad normally honours those requests by doing exactly what the client application asked, and refreshing. There are some misbehaving clients, however, that:

  • try to move their window to the last known absolute position regardless of the current xrandr/xinerama layout
  • move their window to 0, 0 for no particular reason (e.g. rxvt-unicode)
  • issue lots of no-op requests causing flickering (e.g. Steam)

This module provides a replacement handler for ConfigureRequestEvent to work around such misbehaviours.

Synopsis

Usage

To use this, include the following in your xmonad.hs:

import XMonad.Hooks.FloatConfigureReq
import XMonad.Hooks.ManageHelpers
myFloatConfReqHook :: MaybeMaybeManageHook
myFloatConfReqHook = composeAll
    [ … ]
myEventHook :: Event -> X All
myEventHook = mconcat
    [ …
    , floatConfReqHook myFloatConfReqHook
    , … ]
main = xmonad $ …
              $ def{ handleEventHook = myEventHook
                   , … }

Then fill the myFloatConfReqHook with whatever custom rules you need.

As an example, the following will prevent rxvt-unicode from moving its (floating) window to 0, 0 after a font change but still ensure its size increment hints are respected:

className =? "URxvt" -?> pure <$> doFloat

Another example that avoids flickering and xmonad slowdowns caused by the Steam client (completely ignore all its requests, none of which are meaningful in the context of a tiling WM):

map toLower `fmap` className =? "steam" -?> mempty

(this example is also available as fixSteamFlickerMMMH to be added to one's myFloatConfReqHook and also fixSteamFlicker to be added directly to one's handleEventHook)

type MaybeMaybeManageHook = Query (Maybe (Maybe (Endo WindowSet))) Source #

A variant of MaybeManageHook that additionally may or may not make changes to the WindowSet.

floatConfReqHook :: MaybeMaybeManageHook -> Event -> X All Source #

Customizable handler for a ConfigureRequestEvent. If the event's ev_window is a managed floating window, the provided MaybeMaybeManageHook is consulted and its result interpreted as follows:

  • Nothing - no match, fall back to the default handler
  • Just Nothing - match but ignore, no refresh, just send ConfigureNotify
  • Just (Just a) - match, modify WindowSet, refresh, send ConfigureNotify

Known workarounds

fixSteamFlicker :: Event -> X All Source #

A pre-packaged floatConfReqHook that fixes flickering of the Steam client by ignoring ConfigureRequestEvents on any of its floating windows.

To use this, add fixSteamFlicker to your handleEventHook.