module XMonad.Actions.PerLayoutKeys (
chooseActionByLayout,
bindByLayout
) where
import XMonad
import XMonad.StackSet as S
chooseActionByLayout :: (String->X()) -> X()
chooseActionByLayout :: (String -> X ()) -> X ()
chooseActionByLayout String -> X ()
f = forall a. (WindowSet -> X a) -> X a
withWindowSet (String -> X ()
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (layout :: * -> *) a.
LayoutClass layout a =>
layout a -> String
description forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a. Workspace i l a -> l
S.layoutforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a sid sd. Screen i l a sid sd -> Workspace i l a
S.workspace forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a sid sd. StackSet i l a sid sd -> Screen i l a sid sd
S.current)
bindByLayout :: [(String, X())] -> X()
bindByLayout :: [(String, X ())] -> X ()
bindByLayout [(String, X ())]
bindings = (String -> X ()) -> X ()
chooseActionByLayout String -> X ()
chooser where
chooser :: String -> X ()
chooser String
l = case forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup String
l [(String, X ())]
bindings of
Just X ()
action -> X ()
action
Maybe (X ())
Nothing -> case forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup String
"" [(String, X ())]
bindings of
Just X ()
action -> X ()
action
Maybe (X ())
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return ()