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

Thomas Løcke thomas.granvej6 at gmail.com
Thu Mar 21 11:30:24 CET 2013


Thank you to you all for trying to help me solve this issue.

I tried going down the setxkbmap route, but after several hours of failing
I went with the simplest possible solution: I re-mapped <NMLK> to a keycode
that apparently only triggers on Japanese keyboards. This works a charm, as
long as I don't use a Japanese keyboard, in which case I will then toggle
numlock on some to me unknown key.  :D

The "fix" was extremely simple: Edit the <NMLK> = 77; line in
/etc/X11/xkb/keycodes/evdev and restart X. Numlock is now dead as a
doorknob, at least on my Danish keyboard.

I understand that this is not really the right way to do things, but since
I simply could not figure out how to do this the right way, I'm going to
have to settle. And at least I'm not using xmodmap!

:o)
Thomas Løcke



On Thu, Mar 21, 2013 at 10:35 AM, Jochen Keil <jochen.keil at gmail.com> wrote:

> Hello,
>
> 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):
>
> .xkb
> ├── 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
> cumbersome.
>
> # xkbcomp -I${HOME}/.xkb ${HOME}/.xkb/keymap/default $DISPLAY
>
>
> symbols/capslock:
> // 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) ]
>     };
> };
>
>
> symbols/modmap:
> // 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 };
> };
>
>
> keymap/default:
> // 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:
> http://madduck.net/docs/extending-xkb/
>
> I hope this helped you,
>
> Jochen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130321/fb1ba803/attachment-0001.htm>


More information about the xmonad mailing list