aboutsummaryrefslogblamecommitdiffstats
path: root/XMonad/Prompt/XMonad.hs
blob: 992c011a095040254fc806c7f82c27a222a7e325 (plain) (tree)
1
2
3
4
5
6

                                                                             
                                      

                                         
  







                                                                             
                             

                                       
                                          
                                          
                                     

             

                                                             

         
                                                                              
  

                                
  
                           
  
                                                                          
  

                                                          
 


                             
                                   

                                


                                                                      
 
                                                

                                                                                                 
-----------------------------------------------------------------------------
-- |
-- 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
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Prompt
-- > import XMonad.Prompt.XMonad
--
-- in your keybindings add:
--
-- >   , ((modMask x .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
--
-- For detailed instruction on editing the key binding see
-- "XMonad.Doc.Extending#Editing_key_bindings".

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'

-- | An xmonad prompt with a custom command list
xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
xmonadPromptC commands c = mkXPrompt XMonad c (mkComplFunFromList (map fst commands)) runCommand'