我正在尝试创建一个单手键盘布局,并希望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就可以了。
编辑
通过将Super和更改Hyper为Mod4和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
答案1
我自己仍然对 XKB 存在一些(我认为不相关的)问题,但我确实映射了 Hyper 修改器,并且我相信相关设置如下:
兼容:
virtual_modifiers Shift,Control,Meta,Super,Hyper,AltGr;
interpret Hyper_R { action = SetMods(modifiers=Mod4); };
符号:
modifier_map Mod4 { <DELE> }; // Hyper
key <DELE> { type="UNMODIFIED", [ Hyper_R ], repeat=no };
然后像
key <K_36> { type = "SHIFT+HYPER", [ b, B,
XF86AudioRaiseVolume, XF86AudioRaiseVolume ] };
类型
virtual_modifiers Meta,AltGr,Super,Hyper,Mod5;
不需要 Mod5,除非您也使用它;但同样,这里省略 Shift & Control...
type "SHIFT+HYPER" {
modifiers= Shift+Hyper;
map[Shift]= Level2;
map[Hyper]= Level3;
map[Shift+Hyper]= Level4;
};
无论如何,我在尝试重新定义几何图形和关键代码时遇到了比其价值要严重得多的麻烦,最终恢复到形式上pc105
的关键符号<AE01>
,尽管其中许多都被可笑地错误命名。 (例如<DELE>
我的超级键)
附言。有关工作示例,请参阅https://github.com/brpocock/spacey-cadet-keyboard……