aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Prompt/XMonad.hs
diff options
context:
space:
mode:
Diffstat (limited to 'XMonad/Prompt/XMonad.hs')
-rw-r--r--XMonad/Prompt/XMonad.hs54
1 files changed, 54 insertions, 0 deletions
diff --git a/XMonad/Prompt/XMonad.hs b/XMonad/Prompt/XMonad.hs
new file mode 100644
index 0000000..5effbe4
--- /dev/null
+++ b/XMonad/Prompt/XMonad.hs
@@ -0,0 +1,54 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : XMonad.Prompt.XMonad
+-- Copyright : (C) 2007 Andrea Rossato
+-- License : BSD3
+--
+-- Maintainer : andrea.rossato@unibz.it
+-- Stability : unstable
+-- Portability : unportable
+--
+-- A prompt for running XMonad commands
+--
+-----------------------------------------------------------------------------
+
+module XMonad.Prompt.XMonad (
+ -- * Usage
+ -- $usage
+ xmonadPrompt,
+ xmonadPromptC
+ ) where
+
+import XMonad
+import XMonad.Prompt
+import XMonad.Actions.Commands (defaultCommands, runCommand')
+
+-- $usage
+--
+-- in Config.hs add:
+--
+-- > import XMonad.Prompt
+-- > import XMonad.Prompt.XMonad
+--
+-- in you keybindings add:
+--
+-- > , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
+--
+
+-- %import XMonad.Prompt
+-- %import XMonad.Prompt.XMonad
+-- %keybind , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
+
+data XMonad = XMonad
+
+instance XPrompt XMonad where
+ showXPrompt XMonad = "XMonad: "
+
+xmonadPrompt :: XPConfig -> X ()
+xmonadPrompt c = do
+ cmds <- defaultCommands
+ mkXPrompt XMonad c (mkComplFunFromList (map fst cmds)) runCommand'
+
+-- xmonad prompt with custom command list
+xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
+xmonadPromptC commands c = mkXPrompt XMonad c (mkComplFunFromList (map fst commands)) runCommand'