[xmonad] My hack to allow disabling of numlock without messing with my xmonad mod key

Jochen Keil jochen.keil at gmail.com
Thu Mar 21 10:35:47 CET 2013


I'm sending this to the list as well, maybe someone else will find it
useful too.

On 20.03.2013 22:07, Thomas Løcke wrote:
> Great link, and yes I would be very grateful for your commented
config.  :)

It's not very sophisticated and does only a few simple things:
Map 'Menu' to Mod4 and
Replace 'Caps Lock' with Escape

I also had Caps Lock to set the 'Ctrl' modifier together with sending
the 'Escape' keysym which work fine. However, I didn't like the
behaviour so I turned it off again.

It is really important to set the directory structure properly, e.g.
like so (this was one source for headache):

├── keymap
│   └── default -> /home/jrk/.xkb/keymap/default
└── symbols
    ├── capslock -> /home/jrk/.xkb/symbols/capslock
    └── modmap -> /home/jrk/.xkb/symbols/modmap

xkbcomp is also very peculiar on how it wants to be called. You can try
and fiddle around with the include paths, but I remember it being quite

# xkbcomp -I${HOME}/.xkb ${HOME}/.xkb/keymap/default $DISPLAY

// Replace Caps Lock with Escape
// hidden: a variant that can only be used within the configuration file
// partial: not a complete keymap, used to augment/modify other maps
partial hidden modifier_keys
xkb_symbols "capsescape" {
    replace key <CAPS> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ Escape ]
        // this would additionally set the 'Ctrl' modifier
        // (notice the comma after 'Escape')
        // key names like Escape are taken from
        // /usr/include/X11/keysymdef.h without the 'XK_' prefix
        // symbols[Group1] = [ Escape ],
        // actions[Group1] = [ SetMods(modifiers=Control) ]

// you can have more than definition here, depends on with one you load
// in your keymap file
partial hidden modifier_keys
xkb_symbols "mod1" {
    modifier_map Mod1 { Menu };

partial hidden modifier_keys
xkb_symbols "menu" {
    modifier_map Mod4 { Menu };

// kind of a minimal complete definition
// required: xkb_{keycodes,types,compat,symbols}
default xkb_keymap "default" {
    // re
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete" };
    xkb_compat    { include "complete" };
    xkb_symbols   {
        // need a complete keymap, e.g. altgr-intl
        include "pc+us(altgr-intl)+inet(evdev)"
        // our own modifications
        include "capslock(capsescape)"
        include "modmap(menu)"

There are also several useful resources on you system where you can look at.
Keymaps and modification maps can be found in /usr/share/X11/xkb.
Look at symbols/capslock for a good start.
Options, etc. can be found in the rules *.lst files.

And finally here's another link I found useful:

I hope this helped you,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130321/2670b682/attachment.pgp>

More information about the xmonad mailing list