Submap: haddock updates

This commit is contained in:
Brent Yorgey 2007-11-27 19:18:41 +00:00
parent 913bd274b3
commit 0cce3cff7e

View File

@ -3,12 +3,12 @@
-- Module : XMonad.Actions.Submap -- Module : XMonad.Actions.Submap
-- Copyright : (c) Jason Creighton <jcreigh@gmail.com> -- Copyright : (c) Jason Creighton <jcreigh@gmail.com>
-- License : BSD3-style (see LICENSE) -- License : BSD3-style (see LICENSE)
-- --
-- Maintainer : Jason Creighton <jcreigh@gmail.com> -- Maintainer : Jason Creighton <jcreigh@gmail.com>
-- Stability : unstable -- Stability : unstable
-- Portability : unportable -- Portability : unportable
-- --
-- A module that allows the user to create a sub-mapping of keys bindings. -- A module that allows the user to create a sub-mapping of key bindings.
-- --
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@ -27,6 +27,14 @@ import Graphics.X11.Xlib.Extras
import qualified Data.Map as M import qualified Data.Map as M
{- $usage {- $usage
First, import this module into your @~\/.xmonad\/xmonad.hs@:
> import XMonad.Actions.Submap
Allows you to create a sub-mapping of keys. Example: Allows you to create a sub-mapping of keys. Example:
> , ((modMask, xK_a), submap . M.fromList $ > , ((modMask, xK_a), submap . M.fromList $
@ -36,21 +44,22 @@ Allows you to create a sub-mapping of keys. Example:
> , ((0, xK_space), spawn "mpc toggle") > , ((0, xK_space), spawn "mpc toggle")
> ]) > ])
So, for example, to run 'spawn \"mpc next\"', you would hit mod-a (to trigger the So, for example, to run 'spawn \"mpc next\"', you would hit mod-a (to
submapping) and then 'n' to run that action. (0 means \"no modifier\"). You are, trigger the submapping) and then 'n' to run that action. (0 means \"no
of course, free to use any combination of modifiers in the submapping. However, modifier\"). You are, of course, free to use any combination of
anyModifier will not work, because that is a special value passed to XGrabKey() modifiers in the submapping. However, anyModifier will not work,
and not an actual modifier. because that is a special value passed to XGrabKey() and not an actual
modifier.
For detailed instructions on editing your key bindings, see
"XMonad.Doc.Extending#Editing_key_bindings".
-} -}
-- %import XMonad.Actions.Submap -- | Given a 'Data.Map.Map' from key bindings to X () actions, return
-- %keybind , ((modMask, xK_a), submap . M.fromList $ -- an action which waits for a user keypress and executes the
-- %keybind [ ((0, xK_n), spawn "mpc next") -- corresponding action, or does nothing if the key is not found in
-- %keybind , ((0, xK_p), spawn "mpc prev") -- the map.
-- %keybind , ((0, xK_z), spawn "mpc random")
-- %keybind , ((0, xK_space), spawn "mpc toggle")
-- %keybind ])
submap :: M.Map (KeyMask, KeySym) (X ()) -> X () submap :: M.Map (KeyMask, KeySym) (X ()) -> X ()
submap keys = do submap keys = do
XConf { theRoot = root, display = d } <- ask XConf { theRoot = root, display = d } <- ask