XMonad.Actions.Submap

xmonad-contrib-0.13: Third party extensions for xmonad

Copyright | (c) Jason Creighton <jcreigh@gmail.com>
License | BSD3-style (see LICENSE)
Maintainer | Jason Creighton <jcreigh@gmail.com>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Actions.Submap

Contents

- Usage

Description

A module that allows the user to create a sub-mapping of key bindings.

Synopsis

- submap :: Map (KeyMask, KeySym) (X ()) -> X ()
- submapDefault :: X () -> Map (KeyMask, KeySym) (X ()) -> X ()
- submapDefaultWithKey :: ((KeyMask, KeySym) -> X ()) -> Map (KeyMask, KeySym) (X ()) -> X ()

# Usage

First, import this module into your `~/.xmonad/xmonad.hs`:

    import XMonad.Actions.Submap

Allows you to create a sub-mapping of keys. Example:

       , ((modm, 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.

For detailed instructions on editing your key bindings, see XMonad.Doc.Extending.

submap :: Map (KeyMask, KeySym) (X ()) -> X () #

Given a `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.

submapDefault :: X () -> Map (KeyMask, KeySym) (X ()) -> X () #

Like `submap`, but executes a default action if the key did not match.

submapDefaultWithKey :: ((KeyMask, KeySym) -> X ()) -> Map (KeyMask, KeySym) (X ()) -> X () #

Like `submapDefault`, but sends the unmatched key to the default action as argument.