Fix xmonadPromptC and use it.

This commit is contained in:
nicolas.pouillard
2008-03-06 16:39:28 +00:00
parent 7f8882faf2
commit 579a3feb1c

View File

@@ -21,7 +21,8 @@ module XMonad.Prompt.XMonad (
import XMonad import XMonad
import XMonad.Prompt import XMonad.Prompt
import XMonad.Actions.Commands (defaultCommands, runCommand') import XMonad.Actions.Commands (defaultCommands)
import Data.Maybe (fromMaybe)
-- $usage -- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@: -- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
@@ -44,8 +45,10 @@ instance XPrompt XMonad where
xmonadPrompt :: XPConfig -> X () xmonadPrompt :: XPConfig -> X ()
xmonadPrompt c = do xmonadPrompt c = do
cmds <- defaultCommands cmds <- defaultCommands
mkXPrompt XMonad c (mkComplFunFromList' (map fst cmds)) runCommand' xmonadPromptC cmds c
-- | An xmonad prompt with a custom command list -- | An xmonad prompt with a custom command list
xmonadPromptC :: [(String, X ())] -> XPConfig -> X () xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
xmonadPromptC commands c = mkXPrompt XMonad c (mkComplFunFromList' (map fst commands)) runCommand' xmonadPromptC commands c =
mkXPrompt XMonad c (mkComplFunFromList' (map fst commands)) $
fromMaybe (return ()) . (`lookup` commands)