xkb - Remapped modifiers still work as modifiers

4

2

I'm using xkb to create my own keyboard layout. I have a slight problem, though.

key <AE04> {[ Shift_L ]};
key <AE07> {[ Shift_R ]};
key <LFSH> {[ comma  , semicolon , bar    ]};
key <RTSH> {[ period , colon     , period ]};
modifier_map Shift { <AE04>, <AE07> };

The above moves the shift keys to other keys. In order to make the new shift keys actually do something when pressed, I had to add the modifier_map line. The code also puts regular characters on the old shift keys. So far so good.

The problem is that if I hold down the old left shift key and press some character - lets say "a" - I get ",A". So that key works both as a comma key and as a shift key. The latter is not desired. The same thing happens with the right old shift key. In fact, it also happens with control and alt.

How do I solve this? It feels like I need modifier_unmap or something.

lydell

Posted 2013-12-31T12:37:05.440

Reputation: 321

Answers

2

After running setxkbmap -print I realized that pc was included in the symbols list. That symbol file sets up the regular modifiers, which is not desired by me.

Before, I had added my own layout to the /usr/share/X11/xkb/symbols directory and to the /usr/share/X11/xkb/rules/evdev.xml file. That made my layout appear in the GUI to select keyboard layout.

A solution is to make a keyboard layout from scratch instead. One that does not include the pc file. However, there are a lot of standard keyboard stuff in pc that I need. So I read through that file top to bottom picking out the things I needed.

In short, creating a layout from scratch basically means:

  1. Copy the output of setxkbmap -print to a file.
  2. That file just includes other files. Look through the list to see what you can reuse. For me, it meant replacing pc with the name of my own file.
  3. Create new files if needed.
  4. Launch your new layout using xkbcomp -I$HOME/additional-include-folder file-from-step-one.

I learned this (in more detail) from this excellent guide: http://hack.org/mc/writings/xkb.html.

lydell

Posted 2013-12-31T12:37:05.440

Reputation: 321