我正在尝试创建单手键盘布局,并希望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;
};
};
Run Code Online (Sandbox Code Playgroud)
对我来说似乎很好,但是当我尝试时:
~$ 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
Run Code Online (Sandbox Code Playgroud)
(错误代码为 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;
Run Code Online (Sandbox Code Playgroud)
但是,它仍然不起作用:
~$ 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
Run Code Online (Sandbox Code Playgroud)
我自己仍然有一些(我认为不相关的)XKB 问题,但我确实映射了一个 Hyper 修饰符,我相信相关设置如下:
兼容:
virtual_modifiers Shift,Control,Meta,Super,Hyper,AltGr;
interpret Hyper_R { action = SetMods(modifiers=Mod4); };
Run Code Online (Sandbox Code Playgroud)
符号:
modifier_map Mod4 { <DELE> }; // Hyper
key <DELE> { type="UNMODIFIED", [ Hyper_R ], repeat=no };
Run Code Online (Sandbox Code Playgroud)
然后像
key <K_36> { type = "SHIFT+HYPER", [ b, B,
XF86AudioRaiseVolume, XF86AudioRaiseVolume ] };
Run Code Online (Sandbox Code Playgroud)
类型
virtual_modifiers Meta,AltGr,Super,Hyper,Mod5;
Run Code Online (Sandbox Code Playgroud)
除非您也在使用它,否则不需要那里的 Mod5;但同样,这里省略 Shift & Control ...
type "SHIFT+HYPER" {
modifiers= Shift+Hyper;
map[Shift]= Level2;
map[Hyper]= Level3;
map[Shift+Hyper]= Level4;
};
Run Code Online (Sandbox Code Playgroud)
就其价值而言,我在尝试重新定义几何图形和关键代码时遇到的麻烦比它的价值要糟糕得多,并且最终恢复到形式上的pc105
关键符号<AE01>
,尽管其中许多被错误地命名。(例如<DELE>
我的 Hyper 键)
附注。有关工作示例,请参阅https://github.com/brpocock/spacey-cadet-keyboard ...