短背景
我正在尝试用 super/mod4/win-key 代替大写锁定来编写自己的键盘布局。但不管怎样,大写锁定都与 ctrl 绑定在一起。
我目前安装的是 64 位 Ubuntu 16.04。
长背景
给定以下 xkb 符号文件位于~/.config/xkb/symbols/qq
:
partial default alphanumeric_keys
xkb_symbols "basic" {
include "latin(type2)"
include "se(se)"
};
partial alphanumeric_keys
xkb_symbols "se" {
name[Group1]="Sweden";
key <AE05> { [ 5, percent, EuroSign, cent ] };
key <AE11> { [ plus, question, backslash, questiondown ] };
key <AE12> { [dead_acute, dead_grave, plusminus, notsign ] };
key <AC10> { [odiaeresis, Odiaeresis, oslash, Ooblique ] };
key <AC11> { [adiaeresis, Adiaeresis, ae, AE ] };
key <TLDE> { [ section, onehalf, paragraph, threequarters] };
key <BKSL> { [apostrophe, asterisk, acute, multiply ] };
key <SPCE> { [ space, space, space, nobreakspace ] };
key <LSGT> { [ less, greater, bar, brokenbar ] };
include "kpdl(comma)"
include "level3(ralt_switch)"
};
// Swedish Dvorak A5
partial alphanumeric_keys
xkb_symbols "dvorak" {
name[Group1]="Sweden - Dvorak A5";
include "se(basic)"
key <AD01> { [ aring, Aring, braceleft ] };
key <AD02> { [ adiaeresis, Adiaeresis, braceright, bracketleft ] };
key <AD03> { [ odiaeresis, Odiaeresis, bracketleft, bracketright ] };
key <AD04> { [ p, P, bracketright, THORN ] };
key <AD05> { [ y, Y, dollar, yen ] };
key <AD06> { [ f, F, quotedbl, ordfeminine ] };
key <AD07> { [ g, G, question, ENG ] };
key <AD08> { [ c, C, ampersand, copyright ] };
key <AD09> { [ r, R, less, registered ] };
key <AD10> { [ l, L, greater, Lstroke ] };
key <AD11> { [ comma, semicolon, dead_tilde, dead_ogonek ] };
key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, asciicircum ] };
key <AC01> { [ a, A, semicolon, AE ] };
key <AC02> { [ o, O, slash, OE ] };
key <AC03> { [ e, E, parenleft, cent ] };
key <AC04> { [ u, U, parenright, uparrow ] };
key <AC05> { [ i, I, bar, idotless ] };
key <AC06> { [ d, D, numbersign, ETH ] };
key <AC07> { [ h, H, asciicircum, Hstroke ] };
key <AC08> { [ t, T, quotedbl, Tslash ] };
key <AC09> { [ n, N, asciitilde ] };
key <AC10> { [ s, S, ssharp, section ] };
key <AC11> { [ minus, underscore, dead_belowdot, dead_abovedot ] };
key <AB01> { [ period, colon, bar, dead_abovedot ] };
key <AB02> { [ q, Q, equal, Greek_OMEGA ] };
key <AB03> { [ j, J, at ] };
key <AB04> { [ k, K, exclam, ampersand ] };
key <AB05> { [ x, X, backslash, greater ] };
key <AB06> { [ b, B, percent, apostrophe ] };
key <AB07> { [ m, M, grave, masculine ] };
key <AB08> { [ w, W, lstroke, Lstroke ] };
key <AB09> { [ v, V, leftdoublequotemark, grave ] };
key <AB10> { [ z, Z, guillemotleft, less ] };
// Make the < to the lower left part of the keyboard a ctrl key.
replace key <LSGT> { [ Control_L, Control_L ] };
modifier_map Control { <LCTL>, <LSGT> };
// Make caps lock into a super/windows key.
replace key <CAPS> { [ Super_L, Super_L ] };
modifier_map Mod4 { <CAPS>, <LWIN>};
};
设置键盘布局的以下尝试失败:
$ setxkbmap -I ~/.config/xkb qq dvorak -print | xkbcomp -I$HOME/.config/xkb - $DISPLAY
...
Error: Key <CAPS> added to map for multiple modifiers
Using Control, ignoring Mod4.
...
但正如您在给定的配置中看到的那样,没有modifier_map
给出这样的内容,modifier_map
为 Control 给出了 a ,但它只是不包含 .
进一步研究这个问题,我发现 setxkbmap 始终包含此选项:
$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: se
variant: dvorak
options: caps:super_modifier,caps:ctrl_modifier
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+se(dvorak)+inet(evdev)+capslock(ctrl_modifier)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+se(dvorak)+inet(evdev)+capslock(ctrl_modifier)" };
xkb_geometry { include "pc(pc105)" };
};
鉴于我们从未提供过这样的选项,这真的很奇怪。
问题
为什么每次调用 setxkbmap 时总是包含此选项?
修补程序
可以-option
不带任何参数传递来setxkbmap
清除任何默认选项。
setxkbmap -I ~/.config/xkb qq dvorak -option -print | xkbcomp -I$HOME/.config/xkb - $DISPLAY