------------------------------------------------------------------------------- |-- Module : XMonad.Actions.CycleSelectedLayouts-- Copyright : (c) Roman Cheplyaka-- License : BSD3-style (see LICENSE)---- Maintainer : Roman Cheplyaka <roma@ro-che.info>-- Stability : unstable-- Portability : unportable---- This module allows to cycle through the given subset of layouts.-------------------------------------------------------------------------------moduleXMonad.Actions.CycleSelectedLayouts(-- * Usage-- $usagecycleThroughLayouts)whereimportXMonadimportData.List(findIndex)importData.Maybe(fromMaybe)importXMonad.Layout.LayoutCombinators(JumpToLayout(..))importqualifiedXMonad.StackSetasS-- $usage-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:---- > import XMonad hiding ((|||))-- > import XMonad.Layout.LayoutCombinators ((|||))-- > import XMonad.Actions.CycleSelectedLayouts---- > , ((modm, xK_t ), cycleThroughLayouts ["Tall", "Mirror Tall"])---- Make sure you are using NewSelect from XMonad.Layout.LayoutCombinators,-- rather than the Select defined in xmonad core.cycleToNext::(Eqa)=>[a]->a->MaybeacycleToNextlsta=do-- not beautiful but simple and readableind<-findIndex(a==)lstreturn$lst!!ifind==lengthlst-1then0elseind+1-- | If the current layout is in the list, cycle to the next layout. Otherwise,-- apply the first layout from list.cycleThroughLayouts::[String]->X()cycleThroughLayoutslst=dowinset<-getswindowsetletld=description.S.layout.S.workspace.S.current$winsetletnewld=fromMaybe(headlst)(cycleToNextlstld)sendMessage$JumpToLayoutnewld