xkb - переназначенные модификаторы все еще работают как модификаторы

1038
lydell

Я использую xkb для создания собственной раскладки клавиатуры. У меня небольшая проблема.

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

Выше перемещает клавиши Shift к другим клавишам. Чтобы новые клавиши Shift действительно что-то делали при нажатии, мне нужно было добавить modifier_mapстроку. Код также помещает обычные символы на старые клавиши Shift. Все идет нормально.

Проблема в том, что если я удерживаю старую левую клавишу Shift и нажимаю какой-нибудь символ - скажем, «а» - я получаю «А». Так что эта клавиша работает как клавиша с запятой и как клавиша Shift. Последнее не желательно. То же самое происходит с правой старой клавишей Shift. На самом деле, это также происходит с контролем и альт.

Как мне это решить? Такое ощущение, что мне нужно modifier_unmapили что-то.

3

1 ответ на вопрос

2
lydell

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.