我想在键盘上播放/暂停音频,但不幸的是我的笔记本电脑键盘没有任何媒体/功能键。它只有一些我不需要的功能(例如禁用触控板),但我发现这些功能键永远无法重新映射,它们直接从键盘转到操作系统。
所以我选择AltGr+End来发出XF86AudioPlay。并作/usr/share/X11/xkb/symbols/pc
相应修改。
它在 Ubuntu 的视频中运行良好,但在 Firefox 中则不然。 (它在 Rhythmbox 中也不起作用,但我无论如何也听不到声音..)
它完全破坏了我对按键如何传播到程序的理解。我认为窗口系统(奇怪的是,不是键盘系统)为应用程序提供了符号。我将窗口系统设置为将AltGr+End视为 XF86AudioStop。
但是,Firefox(可能还有一些其他程序,但不是全部)不知为何推断我按下了“结束”按钮??
难道这样的窗口/键盘系统的目的不是不必在每个程序中定义相同的符号吗?成为键盘和程序之间的中间人?它似乎没有那样的行为!
➜ ~ xev -event keyboard
Outer window is 0x5000001, inner window is 0x5000002
KeymapNotify event, serial 24, synthetic NO, window 0x0,
keys: 4294967234 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
KeyRelease event, serial 25, synthetic NO, window 0x5000001,
root 0x193, subw 0x0, time 56238457, (588,657), root:(738,872),
state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
" XLookupString gives 1 bytes: (0d) "
XFilterEvent returns: False
KeyPress event, serial 28, synthetic NO, window 0x5000001,
root 0x193, subw 0x0, time 56247439, (588,657), root:(738,872),
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
KeyPress event, serial 28, synthetic NO, window 0x5000001,
root 0x193, subw 0x0, time 56248610, (588,657), root:(738,872),
state 0x90, keycode 115 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
XKeysymToKeycode returns keycode: 172
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x5000001,
root 0x193, subw 0x0, time 56248724, (588,657), root:(738,872),
state 0x90, keycode 115 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
XKeysymToKeycode returns keycode: 172
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x5000001,
root 0x193, subw 0x0, time 56249265, (588,657), root:(738,872),
state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: False
ClientMessage event, serial 28, synthetic YES, window 0x5000001,
message_type 0x145 (WM_PROTOCOLS), format 32, message 0x143 (WM_DELETE_WINDOW)