xmonad-contrib-0.17.1: Community-maintained extensions for xmonad
Copyright(c) 2020 Leon Kowarschick
LicenseBSD3-style (see LICENSE)
MaintainerLeon Kowarschick. <thereal.elkowar@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Util.ActionCycle

Contents

Description

This module provides a way to have "cycling" actions. This means that you can define an X () action that cycles through a list of actions, advancing every time it is executed. This may for exapmle be useful for toggle-style keybindings.

Synopsis

Usage

You can use this module to implement cycling key-bindings by importing ActionCycle

import XMonad.Util.ActionCycle

and then creating a keybinding as follows:

((mod1Mask, xK_t), cycleAction "cycleActions" [ spawn "commmand1", spawn "command2", spawn "command3" ])

Note that the name given to cycleAction must be a unique action per cycle.

cycleAction Source #

Arguments

:: String

Unique name for this action. May be any arbitrary, unique string.

-> [X ()]

List of actions that will be cycled through.

-> X () 

Generate an X () action that cycles through a list of actions, advancing every time the action is called.

cycleActionWithResult Source #

Arguments

:: String

Unique name for this action. May be any arbitrary, unique string.

-> NonEmpty (X a)

Non-empty List of actions that will be cycled through.

-> X a 

Another version of cycleAction that returns the result of the actions. To allow for this, we must make sure that the list of actions is non-empty.