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

Brandon Allbery allbery.b at gmail.com
Wed Mar 20 16:28:25 CET 2013

On Wed, Mar 20, 2013 at 10:57 AM, Thomas Løcke <thomas.granvej6 at gmail.com>wrote:

> I'm not saying this is an xmonad issue as such, I'm saying that when I'm
> using xmonad, weird stuff happens when I use xmodmap to clear my numlock
> key. The same weird stuff does not happen when I use KDE or Fluxbox. These
> two WM's happily accept my .Xmodmap file and numlock stays disabled without
> other keyboard shortcuts being affected.

They appear to be using different ways to intercept keys. xmonad is
minimalist, and deliberately avoiding the higher level mechanisms in favor
of simple passive grabs... but that means we rely on the X server doing the
right thing with the keys at a low level, and if you try to use xmodmap to
modify things hardcoded into Xkb's config this breaks.

(Actually, I would not be too surprised if they're trapping things at an
even lower level which would let them avoid this, but that would be a lot
of additional complex code. It's not too surprising that KDE at least might
do so, since it also lets them avoid some differences in behavior with
non-X11 interfaces [KDE has limited Windows support and somewhat buggy but
functional native OS X support]. I have not studied fluxbox's code, but it
may also be doing this. I can say that I would not particularly want to
trap raw keycode events and implement the modifiers myself, as would be
necessary with this approach; but it would at least partially avoid the X
server getting confused about the modifiers because of Xkb/xmodmap

As for Xkb wizards, there are few such. Not even the xorg devs really
understand it that well! See
http://www.charvolant.org/~doug/xkb/html/index.html (although it seems to
not be responding for me right now). It's a bit of a crawling horror, which
nobody really understands (else they would have sorted out this mess, since
they've known about it for something like ten years) and everyone is afraid
to touch. That said, the basic solution is to use that web page as a guide,
copy the Xkb keymap definition you're using and remove all the
numlock-related parts. (Unfortunately, that may be easier said than done,
given the mess that is Xkb.)

brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20130320/0d76dce6/attachment.htm>

More information about the xmonad mailing list