4

I'm getting this error when trying to use xmodmap to get rid of caps lock:

$ xmodmap -e 'clear Lock'
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  118 (X_SetModifierMapping)
  Value in failed request:  0x17
  Serial number of failed request:  8
  Current serial number in output stream:  8

I'm running xfce. This problem did not occur before I added the Keyboard Layouts applet to a panel; before doing that, I was able to run my xmodmap script to swap Esc and CapsLock:

!Remap Caps_Lock as Escape
remove Lock = Caps_Lock
keysym Caps_Lock = Escape

It may be relevant that I chose alt-capslock as the keyboard switch combo in the Keyboard Layouts preferences.

I've had a similar problem before, on a different machine, running openbox. On that machine, this problem started when I upgraded to Lucid. I reported a bug in xorg. However, it remains unclear whether it's really a problem with xorg, or if I'm just doing something wrong with my configuration.

Have other people experienced this problem? Can someone shed some light on what's going on here? It seems there are quite a few layers involved, and I don't understand any of them particularly well, so any information would be helpful.

update

I've discovered that the problem is specifically triggered by adding the Canada layout variant "Multilingual" (ca-multix). If I instead add the variant "Multilingual (first part)" (ca-multi), the problem does not occur. I think this will probably end up being a usable workaround, but I don't yet know what the difference between these variants is.

I've filed a freedesktop issue, and am commenting on a related ubuntu issue.

intuited
  • 3,538

3 Answers3

2

Modern Xorg uses the XKB extension for supporting keyboard layouts. Xmodmap is emulated through a compatibility layer, but it has quirks. You can disable XKB entirely and Xorg will revert to using the old Xmodmap keyboard mappings. I think it's setting the option XkbDisable to true in xorg.conf, but you probably want to do it the XKB method. There are many configurable options located in /usr/share/X11/xkb/rules/xorg.xml and I think you want caps:swapescape which swaps Caps Lock and Escape. Try setxkbmap -option caps:swapescape

penguin359
  • 12,077
1

The problem arises when you try to add an keysym to an modifier which is already added to another modifier key. It is vital to know, that if you add an keysym to an modifier all other keysyms that companion the keysym in case are added also as to that modifier.

For example:

clear mod5
add mod5    = ISO_Level3_Shift Mode_switch

can result in

mod5        backslash (0x33),  Caps_Lock (0x42),  ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

because you have something like

keycode  66 = Caps_Lock NoSymbol ISO_Level3_Shift

in your ~/.Xmodmap (or .xmodmap,... You can view the current keycode to keysym mapping via "xmodmap -pke")

which will produce the BadValue error in question when you also try to do something like

add lock    = Caps_Lock

because Caps_Lock is already added to the mod5 modifier.

Flow
  • 854
  • 1
  • 11
  • 23
0
setxkbmap -option caps:escape # use caps as esc

or

setxkbmap -option caps:swapescape # to swap caps with esc