xmonad-contrib-0.18.1: Community-maintained extensions for xmonad

Copyright | (c) 2007 Valery V. Vorotyntsev
License | BSD3-style (see LICENSE)
Safe Haskell | None
Language | Haskell2010

XMonad.Util.CustomKeys

Contents

- Usage

Description

Customized key bindings.

See also XMonad.Util.EZConfig in xmonad-contrib.

Synopsis

- customKeys :: (XConfig Layout -> [(KeyMask, KeySym)]) -> (XConfig Layout -> [((KeyMask, KeySym), X ())]) -> XConfig Layout -> Map (KeyMask, KeySym) (X ())
- customKeysFrom :: forall (l :: Type -> Type). XConfig l -> (XConfig Layout -> [(KeyMask, KeySym)]) -> (XConfig Layout -> [((KeyMask, KeySym), X ())]) -> XConfig Layout -> Map (KeyMask, KeySym) (X ())

# Usage

In `xmonad.hs` add:

    import XMonad.Util.CustomKeys

Set key bindings with `customKeys`:

    main = xmonad def { keys = customKeys delkeys inskeys }
        where
          delkeys :: XConfig l -> [(KeyMask, KeySym)]
          delkeys XConfig {modMask = modm} =
              [ (modm .|. shiftMask, xK_Return) -- > terminal
              , (modm .|. shiftMask, xK_c)      -- > close the focused window
              ]
              ++
              [ (modm .|. m, k) | m <- [0, shiftMask], k <- [xK_w, xK_e, xK_r] ]

          inskeys :: XConfig l -> [((KeyMask, KeySym), X ())]
          inskeys conf@(XConfig {modMask = modm}) =
              [ ((mod1Mask,             xK_F2  ), spawn $ terminal conf) -- mod1-f2 %! Run a terminal emulator
              , ((modm,                 xK_Delete), kill) -- %! Close the focused window
              , ((modm .|. controlMask, xK_F11 ), spawn "xscreensaver-command -lock")
              , ((mod1Mask,             xK_Down), spawn "amixer set Master 1-")
              , ((mod1Mask,             xK_Up  ), spawn "amixer set Master 1+")
              ]

customKeys Source #

Arguments

:: (XConfig Layout -> [(KeyMask, KeySym)]) | shortcuts to delete
-> (XConfig Layout -> [((KeyMask, KeySym), X ())]) | key bindings to insert
-> XConfig Layout |
-> Map (KeyMask, KeySym) (X ()) |

Customize `def` -- delete needless shortcuts and insert those you will use.

customKeysFrom Source #

Arguments

:: forall (l :: Type -> Type). XConfig l | original configuration
-> (XConfig Layout -> [(KeyMask, KeySym)]) | shortcuts to delete
-> (XConfig Layout -> [((KeyMask, KeySym), X ())]) | key bindings to insert
-> XConfig Layout |
-> Map (KeyMask, KeySym) (X ()) |

General variant of `customKeys`: customize key bindings of third-party configuration.