Copyright | (c) Christian Dietrich |
---|---|
License | BSD-style (as xmonad) |
Maintainer | stettberger@dokucde.de |
Stability | unstable |
Portability | unportable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Remap Keybinding on the fly, e.g having Dvorak char, but everything with Control/Shift is left us Layout
Synopsis
- setKeyRemap :: KeymapTable -> X ()
- buildKeyRemapBindings :: [KeymapTable] -> [((KeyMask, KeySym), X ())]
- setDefaultKeyRemap :: KeymapTable -> [KeymapTable] -> X ()
- newtype KeymapTable = KeymapTable [((KeyMask, KeySym), (KeyMask, KeySym))]
- emptyKeyRemap :: KeymapTable
- dvorakProgrammerKeyRemap :: KeymapTable
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
newtype KeymapTable Source #
KeymapTable [((KeyMask, KeySym), (KeyMask, KeySym))] |
Instances
Show KeymapTable Source # | |
Defined in XMonad.Actions.KeyRemap showsPrec :: Int -> KeymapTable -> ShowS # show :: KeymapTable -> String # showList :: [KeymapTable] -> ShowS # | |
ExtensionClass KeymapTable Source # | |
Defined in XMonad.Actions.KeyRemap |
emptyKeyRemap :: KeymapTable Source #
The empty KeymapTable, does no translation
dvorakProgrammerKeyRemap :: KeymapTable Source #
The dvorak Programmers keymap, translates from us keybindings to dvorak programmers