mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Submap.hs: info and documentation
This commit is contained in:
parent
56fd6045d9
commit
41658c800c
52
Submap.hs
52
Submap.hs
@ -1,21 +1,22 @@
|
|||||||
{-
|
-----------------------------------------------------------------------------
|
||||||
Allows you to create a sub-mapping of keys. Example:
|
-- |
|
||||||
|
-- Module : XMonadContrib.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.
|
||||||
|
--
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
, ((modMask, xK_a), submap . M.fromList $
|
module XMonadContrib.Submap (
|
||||||
[ ((0, xK_n), spawn "mpc next")
|
-- * Usage
|
||||||
, ((0, xK_p), spawn "mpc prev")
|
-- $usage
|
||||||
, ((0, xK_z), spawn "mpc random")
|
submap
|
||||||
, ((0, xK_space), spawn "mpc toggle")
|
) where
|
||||||
])
|
|
||||||
|
|
||||||
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.
|
|
||||||
-}
|
|
||||||
|
|
||||||
module XMonadContrib.Submap where
|
|
||||||
|
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
|
|
||||||
@ -25,6 +26,23 @@ import Graphics.X11.Xlib
|
|||||||
import Graphics.X11.Xlib.Extras
|
import Graphics.X11.Xlib.Extras
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
|
||||||
|
{- $usage
|
||||||
|
Allows you to create a sub-mapping of keys. Example:
|
||||||
|
|
||||||
|
> , ((modMask, xK_a), submap . M.fromList $
|
||||||
|
> [ ((0, xK_n), spawn "mpc next")
|
||||||
|
> , ((0, xK_p), spawn "mpc prev")
|
||||||
|
> , ((0, xK_z), spawn "mpc random")
|
||||||
|
> , ((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.
|
||||||
|
-}
|
||||||
|
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user