module XMonad.Prompt.XMonad (
xmonadPrompt,
xmonadPromptC,
xmonadPromptCT,
XMonad,
) where
import XMonad
import XMonad.Prompt
import XMonad.Actions.Commands (defaultCommands)
import XMonad.Prelude (fromMaybe)
newtype XMonad = XMonad String
instance XPrompt XMonad where
showXPrompt :: XMonad -> String
showXPrompt (XMonad String
str) = String
str forall a. Semigroup a => a -> a -> a
<> String
": "
xmonadPrompt :: XPConfig -> X ()
xmonadPrompt :: XPConfig -> X ()
xmonadPrompt XPConfig
c = do
[(String, X ())]
cmds <- X [(String, X ())]
defaultCommands
[(String, X ())] -> XPConfig -> X ()
xmonadPromptC [(String, X ())]
cmds XPConfig
c
xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
xmonadPromptC = String -> [(String, X ())] -> XPConfig -> X ()
xmonadPromptCT String
"XMonad"
xmonadPromptCT :: String -> [(String, X ())] -> XPConfig -> X ()
xmonadPromptCT :: String -> [(String, X ())] -> XPConfig -> X ()
xmonadPromptCT String
title' [(String, X ())]
commands XPConfig
c =
forall p.
XPrompt p =>
p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
mkXPrompt (String -> XMonad
XMonad String
title') XPConfig
c (XPConfig -> [String] -> ComplFunction
mkComplFunFromList' XPConfig
c (forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a, b) -> a
fst [(String, X ())]
commands)) forall a b. (a -> b) -> a -> b
$
forall a. a -> Maybe a -> a
fromMaybe (forall (m :: * -> *) a. Monad m => a -> m a
return ()) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a b. Eq a => a -> [(a, b)] -> Maybe b
`lookup` [(String, X ())]
commands)