我正在尝试创建单手键盘布局,并希望Hyper在按某些键时用来产生特殊键。
例如,当我按Hyper_L和时B,我希望XKB产生XF86AudioRaiseVolume。
相关部分来自custom_2.kbd
(完整代码位于http://pastebin.com/gm8cggn3):
xkb_keycodes {
<K_36> = 54; // b B XF86AudioRaiseVolume
<K_85> = 133; // Hyper_L
};
xkb_symbols {
key <K_36> { type = "HYPER_LEVEL", [ b, B, XF86AudioRaiseVolume ] };
key <K_85> { type = "ONE_LEVEL", [ Hyper_L ] };
};
xkb_compatibility {
interpret Hyper_L { action = SetMods(modifiers=Hyper); };
};
xkb_types {
type "HYPER_LEVEL" {
modifiers= Shift+Hyper;
map[Shift]= Level2;
map[Hyper]= Level3;
map[Shift+Hyper]= Level3;
};
};
对我来说似乎很好,但是当我尝试时:
~$ xkbcomp custom_2.kbd $DISPLAY
Error: Identifier "Hyper" of type int is unknown
Error: Key type mask field must be a modifier mask
Key type definition ignored
Warning: Map entry for unused modifiers in HYPER_LEVEL
Using none instead of Shift
Error: Identifier "Hyper" of type int is unknown
Error: The key type map entry field must be a modifier mask
Ignoring illegal assignment in HYPER_LEVEL
Error: Identifier "Hyper" of type int is unknown
Error: The key type map entry field must be a modifier mask
Ignoring illegal assignment in HYPER_LEVEL
-> 1
(错误代码为1)
现在我被卡住了。有谁知道如何进行这项工作?没有的解决方案Hyper可以。
编辑
通过将Superand 更改Hyper为Mod4and Mod5,该错误消失了:
~$ xkbcomp custom_3.kbd
( no output )
~$ diff custom_{2,3}.kbd
188,190c188,190
< interpret Super_L { action = SetMods(modifiers=Super); };
< interpret Hyper_L { action = SetMods(modifiers=Hyper); };
< }c;
---
> interpret Super_L { action = SetMods(modifiers=Mod4); };
> interpret Hyper_L { action = SetMods(modifiers=Mod5); };
> };
204c204
< modifiers= Shift+Hyper;
---
> modifiers= Shift+Mod5;
206,207c206,207
< map[Hyper]= Level3;
< map[Shift+Hyper]= Level3;
---
> map[Mod5]= Level3;
> map[Shift+Mod5]= Level3;
但是,它仍然不起作用:
~$ xkbcomp custom_3.kbd $DISPLAY
Error: success in unknown
Couldn't write keyboard description to :0.0
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 135 (XKEYBOARD)
Minor opcode of failed request: 9 (XkbSetMap)
Value in failed request: 0x8010202
Serial number of failed request: 12
Current serial number in output stream: 14
-> 1