Tony Zorman 3d65a6bf72 Refer to the tutorial instead of X.D.Extending more often
Essentially, whenever the tutorial actually has decent material on the
subject matter.  The replacement is roughly done as follows:

  - logHook → tutorial
  - keybindings → tutorial, as this is thoroughly covered
  - manageHook → tutorial + X.D.Extending, as the manageHook stuff the
    tutorial talks about is a little bit of an afterthought.
  - X.D.Extending (on its own) → tutorial + X.D.Extending
  - layoutHook → tutorial + X.D.Extending, as the tutorial, while
    talking about layouts, doesn't necessarily have a huge focus there.
  - mouse bindings → leave this alone, as the tutorial does not at all
    talk about them.
2022-10-21 09:17:43 +02:00

62 lines
1.9 KiB
Haskell

-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Prompt.XMonad
-- Description : A prompt for running XMonad commands.
-- 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,
xmonadPromptCT,
XMonad,
) where
import XMonad
import XMonad.Prompt
import XMonad.Actions.Commands (defaultCommands)
import XMonad.Prelude (fromMaybe)
-- $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:
--
-- > , ((modm .|. controlMask, xK_x), xmonadPrompt def)
--
-- For detailed instruction on editing the key binding see
-- <https://xmonad.org/TUTORIAL.html#customizing-xmonad the tutorial>.
newtype XMonad = XMonad String
instance XPrompt XMonad where
showXPrompt (XMonad str) = str <> ": "
xmonadPrompt :: XPConfig -> X ()
xmonadPrompt c = do
cmds <- defaultCommands
xmonadPromptC cmds c
-- | An xmonad prompt with a custom command list
xmonadPromptC :: [(String, X ())] -> XPConfig -> X ()
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)