我对重新映射键盘上的一些键感兴趣。特别是,我希望按住函数键,按下F1键,并让这个触发器成为脚本。我知道xev对于找出键压与什么键码相关联是有用的。例如,当我按下x键时,我得到:
KeyPress event, serial 41, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1597243, (-190,43), root:(910,336),
state 0x0, keycode 53 (keysym 0x78, x), same_screen YES,
XLookupString gives 1 bytes: (78) "x"
XmbLookupString gives 1 bytes: (78) "x"
XFilterEvent returns: False
KeyRelease event, serial 41, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1597363, (-190,43), root:(910,336),
state 0x0, keycode 53 (keysym 0x78, x), same_screen YES,
XLookupString gives 1 bytes: (78) "x"
XFilterEvent returns: False这对我来说很有意义。
然而,当我按下函数-F1时,我不明白会发生什么。为什么按函数-f1的行为好像我也按住了Windows按钮,并键入了字母l**?*
当我按函数-f1时,xev输出:
KeyPress event, serial 41, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1735349, (-157,221), root:(943,514),
state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 41, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1735350, (-157,221), root:(943,514),
state 0x40, keycode 46 (keysym 0x6c, l), same_screen YES,
XLookupString gives 1 bytes: (6c) "l"
XmbLookupString gives 1 bytes: (6c) "l"
XFilterEvent returns: False
MappingNotify event, serial 41, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
KeyPress event, serial 41, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1735356, (-157,221), root:(943,514),
state 0x40, keycode 160 (keysym 0x1008ff2d, XF86ScreenSaver), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 41, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1735357, (-157,221), root:(943,514),
state 0x40, keycode 160 (keysym 0x1008ff2d, XF86ScreenSaver), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
MappingNotify event, serial 42, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
KeyRelease event, serial 42, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1735463, (-157,221), root:(943,514),
state 0x40, keycode 46 (keysym 0x6c, l), same_screen YES,
XLookupString gives 1 bytes: (6c) "l"
XFilterEvent returns: False
KeyRelease event, serial 43, synthetic NO, window 0x2600001,
root 0xae, subw 0x0, time 1735470, (-157,221), root:(943,514),
state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False当我按下聚焦于文本窗口的函数-F1时,它会键入字母l。
背景信息:在东芝r835上运行Lubuntu11.10。很高兴提供任何可能有帮助的进一步细节。
编辑:
比较而言,当我输入函数-F12时,我得到:
KeyPress event, serial 41, synthetic NO, window 0x2200001,
root 0xae, subw 0x0, time 8369184, (-620,473), root:(480,766),
state 0x0, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 41, synthetic NO, window 0x2200001,
root 0xae, subw 0x0, time 8369344, (-620,473), root:(480,766),
state 0x0, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False我想看看F1-F12的钥匙是否有什么特别之处,但看起来至少有一些是我所期望的。
发布于 2012-03-03 23:35:05
当你说函数F1时,我想你的意思是在笔记本电脑的角落按下这个有趣的Fn键,然后是键盘左上角的F1键。你试着映射一些笔记本电脑键盘上的额外按键,比如睡眠。看起来那把钥匙真的是为你按了多个键。首先,我认为Win+L是一个组合。在Windows上,此快捷方式锁定屏幕,但不启动屏幕保护程序。接下来,我看到了XF86ScreenSaver的映射,这可能意味着X看到了某种睡眠密钥。我猜你笔记本键盘上的那个键是物理上发送的,这三个键代码是Win +L+ Sleep,方便Windows用户快速锁定屏幕并激活屏幕保护程序。我不确定有什么好办法把这些过滤掉。键盘上的Fn键通常不会被Linux内核看到。相反,它改变了键盘告诉内核的代码。当我试图在Linux上使用带有PowerPoint的USB遥控器时,我发现启动/停止演示的按钮只是一个发出交替的F5和ESC密钥代码的蹩脚控件。其他按钮就像发出b来空白屏幕一样蹩脚。
发布于 2012-03-05 13:44:49
为此,我使用了xbindkeys。简单地运行xbindkey -k并按下所需的按钮。您应该得到如下的输出:
"(Scheme function)"
m:0x0 + c:244
XF86Battery将其粘贴到主目录中的.xbindkeysrc文件中。现在,您希望用希望执行的命令替换(Scheme Function)部件,例如运行脚本的perl /home/my_script.pl。这将使您重新映射键的任务更加容易。
https://unix.stackexchange.com/questions/33355
复制相似问题