mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 12:41:52 -07:00
X.P.XMonad: Add xmonadPromptCT
Currently when creating an XMonad Prompt one is stuck with "XMonad:" as the title for the prompt. However, sometimes it is nice to be able to create a prompt with custom commands that has a particular title. This changes the internals of X.P.XMonad to facilitate this and adds xmonadPromptCT as a user facing function.
This commit is contained in:
committed by
slotThe
parent
81339f2044
commit
b79fbf6975
@@ -17,6 +17,7 @@ module XMonad.Prompt.XMonad (
|
||||
-- $usage
|
||||
xmonadPrompt,
|
||||
xmonadPromptC,
|
||||
xmonadPromptCT,
|
||||
XMonad,
|
||||
) where
|
||||
|
||||
@@ -38,10 +39,10 @@ import XMonad.Prelude (fromMaybe)
|
||||
-- For detailed instruction on editing the key binding see
|
||||
-- "XMonad.Doc.Extending#Editing_key_bindings".
|
||||
|
||||
data XMonad = XMonad
|
||||
newtype XMonad = XMonad String
|
||||
|
||||
instance XPrompt XMonad where
|
||||
showXPrompt XMonad = "XMonad: "
|
||||
showXPrompt (XMonad str) = str <> ": "
|
||||
|
||||
xmonadPrompt :: XPConfig -> X ()
|
||||
xmonadPrompt c = do
|
||||
@@ -50,6 +51,10 @@ xmonadPrompt c = do
|
||||
|
||||
-- | An xmonad prompt with a custom command list
|
||||
xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
|
||||
xmonadPromptC commands c =
|
||||
mkXPrompt XMonad c (mkComplFunFromList' c (map fst commands)) $
|
||||
xmonadPromptC = xmonadPromptCT "XMonad"
|
||||
|
||||
-- | An xmonad prompt with a custom command list and a custom title
|
||||
xmonadPromptCT :: String -> [(String, X ())] -> XPConfig -> X ()
|
||||
xmonadPromptCT title' commands c =
|
||||
mkXPrompt (XMonad title') c (mkComplFunFromList' c (map fst commands)) $
|
||||
fromMaybe (return ()) . (`lookup` commands)
|
||||
|
Reference in New Issue
Block a user