xmonad-contrib-0.18.2.9: Community-maintained extensions for xmonad
Copyright(c) 20222026 L. S. Leary
LicenseBSD3-style (see LICENSE)
MaintainerL.S.Leary.II@gmail.com
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Actions.Repeatable

Description

This module factors out the shared logic of XMonad.Actions.CycleRecentWS, XMonad.Actions.CycleWorkspaceByScreen, XMonad.Actions.CycleWindows and XMonad.Actions.MostRecentlyUsed.

See the source of these modules for usage examples.

Synopsis

Repeatable

repeatable Source #

Arguments

:: [KeySym]

The list of KeySyms under the modifiers used to invoke the action.

-> KeySym

The keypress that invokes the action.

-> (EventType -> KeySym -> X ())

The keypress handler.

-> X () 

An action that temporarily usurps and responds to key press/release events, concluding when one of the modifier keys is released.

repeatableSt Source #

Arguments

:: Monoid a 
=> s

Initial state.

-> [KeySym]

The list of KeySyms under the modifiers used to invoke the action.

-> KeySym

The keypress that invokes the action.

-> (EventType -> KeySym -> StateT s X a)

The keypress handler.

-> X (a, s) 

A more general variant of repeatable with a stateful handler, accumulating a monoidal return value throughout the events.

repeatableM Source #

Arguments

:: (MonadIO m, Monoid a) 
=> (m a -> X b)

How to run the monad in X.

-> [KeySym]

The list of KeySyms under the modifiers used to invoke the action.

-> KeySym

The keypress that invokes the action.

-> (EventType -> KeySym -> m a)

The keypress handler.

-> X b 

A more general variant of repeatable with an arbitrary monadic handler, accumulating a monoidal return value throughout the events.

Concludable

data NotOurEvent Source #

Constructors

NotOurEvent 

data Done Source #

Constructors

Done 

concludable Source #

Arguments

:: [KeySym]

The list of KeySyms under the modifiers used to invoke the action.

-> KeySym

The keypress that invokes the action.

-> (EventType -> KeySym -> IO (Either NotOurEvent e))

Handle keypresses by translating them into custom events. If the function produces NotOurEvent then we conclude and put the X Event back into the queue.

-> (e -> X (Either Done ()))

The custom event handler.

-> X () 

A generalisation of repeatable which may conclude early with NotOurEvent or Done.

concludableSt Source #

Arguments

:: Monoid a 
=> s

Initial state.

-> [KeySym]

The list of KeySyms under the modifiers used to invoke the action.

-> KeySym

The keypress that invokes the action.

-> (EventType -> KeySym -> IO (Either NotOurEvent e))

Handle keypresses by translating them into custom events. If the function produces NotOurEvent then we conclude and put the X Event back into the queue.

-> (e -> StateT s X (Either Done a))

The custom event handler.

-> X (a, s) 

A more general variant of concludable with a stateful handler, accumulating a monoidal return value throughout the events.

concludableM Source #

Arguments

:: (MonadIO m, Monoid a) 
=> (m a -> X b)

How to run the monad in X.

-> [KeySym]

The list of KeySyms under the modifiers used to invoke the action.

-> KeySym

The keypress that invokes the action.

-> (EventType -> KeySym -> IO (Either NotOurEvent e))

Handle keypresses by translating them into custom events. If the function produces NotOurEvent then we conclude and put the X Event back into the queue.

-> (e -> m (Either Done a))

The custom event handler.

-> X b 

A more general variant of concludable with an arbitrary monadic handler, accumulating a monoidal return value throughout the events.