我有一个键盘,它只是随 PC 一起提供的通用 Gateway 键盘。我想知道是否可以使用它上面的音量键。xev
按下音量调高和音量调低键后,我得到了输出。
KeyPress event, serial 35, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3904956, (-45,-188), root:(378,348),
state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 38, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3905056, (-45,-188), root:(378,348),
state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 38, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3906475, (-45,-188), root:(378,348),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 38, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3906574, (-45,-188), root:(378,348),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
那么我该怎么做才能让它们改变我的音量Crunchbang Linux?
提前致谢!
答案1
答案2
在笔记本电脑上的类似情况下,我让窗口管理器(Fluxbox)通过以下键盘快捷键处理事件~/.fluxbox/keys
:
XF86AudioLowerVolume :ExecCommand amixer sset -q Master,0 5%-
XF86AudioRaiseVolume :ExecCommand amixer sset -q Master,0 5%+
XF86AudioMute :ExecCommand amixer sset -q Master,0 toggle
据我所知,Crunchbang 默认使用 OpenBox,所以解决方案可能与我的 Fluxbox 类似。
答案3
你需要配置 hal 策略。
答案4
这是我在 rc.xml 中添加的内容
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<execute>amixer sset -q Master,0 5%+</execute>
</action>
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<execute>amixer sset -q Master,0 5%-</execute>
</action>
</keybind>
<keybind key="XF86AudioMute">
<action name="Execute">
<execute>ExecCommand amixer sset -q Master,0 toggle</execute>
</action>
</keybind>