Haskell XMonad中的右GUI键
是否有可能为XMonad中的L_GUI+键和R_GUI+键进行不同的绑定,如果有,那么如何绑定?Haskell XMonad中的右GUI键,haskell,usability,xmonad,Haskell,Usability,Xmonad,是否有可能为XMonad中的L_GUI+键和R_GUI+键进行不同的绑定,如果有,那么如何绑定? 同样的问题也适用于R\u CTRL、R\u SFT和R\u ALT,但它们对我来说并不重要。对于这些问题,可以问xev它对按键的看法。以下是我按下左控制+a和右控制+a时的一些示例输出: KeyPress event, serial 36, synthetic NO, window 0x1400001, root 0x2a9, subw 0x0, time 4207488563, (419,
同样的问题也适用于R\u CTRL、R\u SFT和R\u ALT,但它们对我来说并不重要。对于这些问题,可以问xev它对按键的看法。以下是我按下左控制+a和右控制+a时的一些示例输出:
KeyPress event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207488563, (419,468), root:(2341,612),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207489283, (419,468), root:(2341,612),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XmbLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207489403, (419,468), root:(2341,612),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207490035, (419,468), root:(2341,612),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207538195, (-175,35), root:(1747,179),
state 0x0, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207538595, (-175,35), root:(1747,179),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XmbLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207538715, (-175,35), root:(1747,179),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1400001,
root 0x2a9, subw 0x0, time 4207539227, (-175,35), root:(1747,179),
state 0x4, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
正如您所看到的,虽然左控制和右控制在按下时产生不同的按键,但在另一次按键时按下时产生相同的状态。因此,在我当前的设置中无法区分它们
如果您想让它们成为不同的修饰符,可以使用xmodmap进行安排;然而,修饰符的总数是有限的——我想大概有四个左右。但有关详细信息,请参阅xmodmap文档。我不熟悉L_GUI键,但通常情况下,如果键返回不同的代码,则可以使用不同的键映射。确定这一点的简单方法是使用
xev
。运行xev
时,键入一个键会导致两个事件,一个用于按键,另一个用于按键释放
我有一个爱尔兰键盘。当我运行xev
并键入左Alt键时,事件为:
KeyPress event, serial 33, synthetic NO, window 0xe00001,
root 0x1dc, subw 0x0, time 4233053053, (748,263), root:(1711,266),
state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 33, synthetic NO, window 0xe00001,
root 0x1dc, subw 0x0, time 4233053237, (748,263), root:(1711,266),
state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
所以密钥是64。请注意,按键im是Alt\u l
。要映射此键,我将在Graphics.X11.Types中查找,并发现此键的常量为xK\u Alt\u L
当我按下键盘上的右Alt键(标记为Alt Gr)时,我得到一个不同的键码108。所以我可以有不同的绑定
KeyPress event, serial 33, synthetic NO, window 0xe00001,
root 0x1dc, subw 0x0, time 4233053813, (748,263), root:(1711,266),
state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 33, synthetic NO, window 0xe00001,
root 0x1dc, subw 0x0, time 4233053989, (748,263), root:(1711,266),
state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: False
我可能错了,但我认为美国键盘对左右Alt键返回相同的键码。在这种情况下,键不能有不同的绑定。哦,有趣的是,我没有想到他想要绑定实际的键,而不是将它们用作不同的修饰符。如果这是他想要的,这是一个很好的答案!重读他的答案,我认为他确实用了它们作为修饰语。但是我想我会把答案留在这里,因为它可能会帮助其他人。此外,它还显示了一个示例,其中键有不同的键代码。根据xmodmap,修饰符的有效名称是:Shift、Lock、Control、Mod1、Mod2、Mod3、Mod4 AFAIK、Mod1用于两个Alt,Mod4用于两个Gui。不确定Mod2和Mod3的用途,但如果它们未使用,那么我可以重新映射它们并根据需要使用它们。谢谢@cub uanic注意到xmonad对numlock有一些特殊的处理,所以您可能希望避免使用它。Daniel,我在哪里可以找到关于numlock这种特殊处理的更多信息?我以前从未听说过它。@cub uanic不知道任何英语写作,但你可以在源代码中搜索
numberlockMask
开始。
KeyPress event, serial 33, synthetic NO, window 0xe00001,
root 0x1dc, subw 0x0, time 4233053813, (748,263), root:(1711,266),
state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 33, synthetic NO, window 0xe00001,
root 0x1dc, subw 0x0, time 4233053989, (748,263), root:(1711,266),
state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: False