xmonad-contrib-0.14: Third party extensions for xmonad

Copyright(c) Christian Dietrich
LicenseBSD-style (as xmonad)
Maintainerstettberger@dokucde.de
Stabilityunstable
Portabilityunportable
Safe HaskellNone
LanguageHaskell98

XMonad.Actions.KeyRemap

Contents

Description

Remap Keybinding on the fly, e.g having Dvorak char, but everything with Control/Shift is left us Layout

Synopsis

Usage

Provides the possibility to remap parts of the keymap to generate different keys

  • E.g You want to type Programmers Dvorak, but your keybindings should be the normal us layout after all

First, you must add all possible keybindings for all layout you want to use:

  keys = myKeys ++ buildKeyRemapBindings [dvorakProgrammerKeyRemap,emptyKeyRemap]

Then you must add setDefaultKeyRemap to your startup hook (e.g. you want to set the empty keyremap (no remapping is done) as default after startup):

myStartupHook :: X()
myStartupHook = do
  setWMName "LG3D"
  setDefaultKeyRemap emptyKeyRemap [dvorakProgrammerKeyRemap, emptyKeyRemap]

Then you add keybindings for changing keyboard layouts;

, ((0                    , xK_F1    ), setKeyRemap emptyKeyRemap)
, ((0                    , xK_F2    ), setKeyRemap dvorakProgrammerKeyRemap)

When defining your own keymappings, please be aware of:

  • If you want to emulate a key that is shifted on us you must emulate that keypress:
KeymapTable [((0, xK_a), (shiftMask, xK_5))] -- would bind 'a' to '%'
KeymapTable [((shiftMask, xK_a), (0, xK_5))] -- would bind 'A' to '5'
  • the dvorakProgrammerKeyRemap uses the original us layout as lookuptable to generate the KeymapTable
  • KeySym and (ord Char) are incompatible, therefore the magic numbers in dvorakProgrammerKeyRemap are nessesary

setKeyRemap :: KeymapTable -> X () Source #

Using this in the keybindings to set the actual Key Translation table

buildKeyRemapBindings :: [KeymapTable] -> [((KeyMask, KeySym), X ())] Source #

Append the output of this function to your keybindings with ++

setDefaultKeyRemap :: KeymapTable -> [KeymapTable] -> X () Source #

Adding this to your startupHook, to select your default Key Translation table. You also must give it all the KeymapTables you are willing to use

emptyKeyRemap :: KeymapTable Source #

The empty KeymapTable, does no translation

dvorakProgrammerKeyRemap :: KeymapTable Source #

The dvorak Programmers keymap, translates from us keybindings to dvorak programmers