组合键的xmodmap-如何切换Fn行为?


9

使用通过USB的Logitech K290键盘时,默认情况下无法访问F.键,Fn在使用它们之前我需要先按一下,这实际上是不可用的。

Fn仅此键不会触发中的任何事件xev

F1不按就Fn触发两个键事件,分别是键码50(Shift_L)和键码133(Super_L),并在我的Kubuntu上显示一条消息“触摸板已禁用”(每个键都F1通过相同的消息F4

尽管大多数媒体密钥都可以使用,但我还是希望直接访问F.密钥。您知道切换Fn行为的任何方式吗?

这是我F1不按时的输出Fn

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638420, (-352,274), root:(1462,621),
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638420, (-352,274), root:(1462,621),
    state 0x11, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  4294967238 0   0   0   0   0   4   0   0   0   0   0   0   0   0   0   
           32  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638436, (-352,274), root:(1462,621),
    state 0x51, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638436, (-352,274), root:(1462,621),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MappingNotify event, serial 40, synthetic NO, window 0x0,
    request MappingPointer, first_keycode 0, count 0

对于F2(仍然没有Fn):

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782724, (-202,438), root:(1491,799),
    state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782724, (-202,438), root:(1491,799),
    state 0x18, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  4294967238 0   0   0   0   0   0   0   1   0   0   0   0   0   0   0   
           32  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782780, (-202,438), root:(1491,799),
    state 0x58, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782780, (-202,438), root:(1491,799),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

F1Fn给出预期结果:

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64820204, (-856,-213), root:(1097,247),
    state 0x10, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64820284, (-856,-213), root:(1097,247),
    state 0x10, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

2
通常<kbd> Fn </ kbd>在键盘的硬件级别上起作用。但愿键码,而不是键符,的F键仍然有所不同,当它没有被按下。您能否再运行xev一次并将输出粘贴到两个不同的F键上?
9000

我遇到了同样的问题:(这个答案(askubuntu.com/a/285604/121193)可能是有用的,但它会是一件好...简单。

1
可悲的是,Solaar仅适用于无线发射器,不适用于有线发射器:(
user55574

我将从查看BIOS设置开始。一些允许默认的F键,交换Fn键如..
乔纳斯柏林

真是可恶的是F1重复使用的键码50,所以你不能改变什么呢50任..:P
乔纳斯柏林

Answers:


1

通过在x Fn+Fx和之间交换密钥代码,我获得了相同的结果。Fx1,2,...12

  1. 使用xmodmap -pke以获取当前键码和keysymbols的列表。
  2. 然后运行xev并按一下,F1F12保持其键码的记录。
  3. 然后在~/.Xmodmap文件中进行交换。

例如,在我的系统中,结果为(1):

keycode 67 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
keycode 69 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
keycode 70 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
...

keycode 121 = XF86AudioMute NoSymbol XF86AudioMute
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 198 = XF86AudioMicMute NoSymbol XF86AudioMicMute
..

然后我把它换成~/.Xmodmap

keycode 121 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 122 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
keycode 123 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
keycode 198 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
...


keycode 67 = XF86AudioMute NoSymbol XF86AudioMute
keycode 68 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 69 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 70 = XF86AudioMicMute NoSymbol XF86AudioMicMute
...

然后采取影响力运行xmodmap ~/.Xmodmap


0

xev无法显示桌面环境捕获的事件。测试键的更好方法是使用showkey命令(在Linux控制台上,而不是X11内)。我猜测操作系统实际上正在接收Shift + Super +某些按键组合。

尽管可以想像地将上述组合重新映射为F键,但这可能会很麻烦:您必须“释放” Shift键(因为键盘模拟了按下它),并且使Shift + F1起作用更加复杂,因为这需要跟踪先前是否按住Shift键。

此问题在笔记本电脑上非常常见,笔记本电脑通常具有组合键来切换多媒体热键,或者在其BIOS /固件中具有选项。但是正如您提到的,这与外部键盘的特定型号有关,在网上查看时,我发现了这个项目:

https://github.com/milgner/k290-fnkeyctl

该项目的说明指出,它“重新配置了Logitech K290键盘上的功能键的工作方式”,因此值得一试。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.