aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrent Yorgey <byorgey@gmail.com>2007-11-27 20:18:41 +0100
committerBrent Yorgey <byorgey@gmail.com>2007-11-27 20:18:41 +0100
commit6105251111ffc263f42ba17143880b6f30d3d8f5 (patch)
treefc88a566a6eba9d306eda6f6dd53d4fe44d79d1c
parent5b1b3280ddcc465db6bb148c2d6a0df9fe516df8 (diff)
downloadXMonadContrib-6105251111ffc263f42ba17143880b6f30d3d8f5.tar.gz
XMonadContrib-6105251111ffc263f42ba17143880b6f30d3d8f5.tar.xz
XMonadContrib-6105251111ffc263f42ba17143880b6f30d3d8f5.zip
Submap: haddock updates
darcs-hash:20071127191841-bd4d7-01b838e5c4a0c8f00b4745e5a902824722d17123.gz
-rw-r--r--XMonad/Actions/Submap.hs39
1 files changed, 24 insertions, 15 deletions
diff --git a/XMonad/Actions/Submap.hs b/XMonad/Actions/Submap.hs
index 4e1d3a5..a43233d 100644
--- a/XMonad/Actions/Submap.hs
+++ b/XMonad/Actions/Submap.hs
@@ -3,12 +3,12 @@
-- Module : XMonad.Actions.Submap
-- Copyright : (c) Jason Creighton <jcreigh@gmail.com>
-- License : BSD3-style (see LICENSE)
---
+--
-- Maintainer : Jason Creighton <jcreigh@gmail.com>
-- Stability : unstable
-- 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
{- $usage
+
+
+
+
+First, import this module into your @~\/.xmonad\/xmonad.hs@:
+
+> import XMonad.Actions.Submap
+
Allows you to create a sub-mapping of keys. Example:
> , ((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")
> ])
-So, for example, to run 'spawn \"mpc next\"', you would hit mod-a (to trigger the
-submapping) and then 'n' to run that action. (0 means \"no modifier\"). You are,
-of course, free to use any combination of modifiers in the submapping. However,
-anyModifier will not work, because that is a special value passed to XGrabKey()
-and not an actual modifier.
--}
+So, for example, to run 'spawn \"mpc next\"', you would hit mod-a (to
+trigger the submapping) and then 'n' to run that action. (0 means \"no
+modifier\"). You are, of course, free to use any combination of
+modifiers in the submapping. However, anyModifier will not work,
+because that is a special value passed to XGrabKey() and not an actual
+modifier.
--- %import XMonad.Actions.Submap
--- %keybind , ((modMask, xK_a), submap . M.fromList $
--- %keybind [ ((0, xK_n), spawn "mpc next")
--- %keybind , ((0, xK_p), spawn "mpc prev")
--- %keybind , ((0, xK_z), spawn "mpc random")
--- %keybind , ((0, xK_space), spawn "mpc toggle")
--- %keybind ])
+For detailed instructions on editing your key bindings, see
+"XMonad.Doc.Extending#Editing_key_bindings".
+
+-}
+-- | Given a 'Data.Map.Map' from key bindings to X () actions, return
+-- an action which waits for a user keypress and executes the
+-- corresponding action, or does nothing if the key is not found in
+-- the map.
submap :: M.Map (KeyMask, KeySym) (X ()) -> X ()
submap keys = do
XConf { theRoot = root, display = d } <- ask