窗口管理器安裝的是i3,沒有鼠標控制音量的地方,鍵盤上的功能鍵無論用,但調節屏幕亮度的功能鍵是能夠用的。一個笨方法是安裝alsa-utils,而後在終端輸入alsamixer,再用出來的字符界面的音量控制器調節音量,不方便。 php
好辦法是綁定按鍵。折騰步驟以下 : html
1.終端輸入xev,再安音量控制鍵,通常筆記本是Fn + 左或右方向鍵,退出xev後,能夠看到顯示的按鍵事件,大概是這個樣子: linux
KeyRelease event, serial 32, synthetic NO, window 0x1800001, root 0x7c, subw 0x0, time 8121754, (482,545), root:(486,565), state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 32, synthetic NO, window 0x1800001, root 0x7c, subw 0x0, time 8122127, (482,545), root:(486,565), state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
其中XF86AudioRaiseVolume,XF86AudioLowerVolume就是按鍵名,一個增長音量,一個減少,可見返回了False. 也可用命令 xev | grep keysym 去掉那些多餘的輸出.
shell
2. amixer是命令行的ALSA聲卡驅動調節器工具.能夠man一下看選項,這裏舉個栗子: app
amixer set Master 3%+ 或amixer set Master 3dB+ (音量增大3%), 編輯器
amixer set Master 3%- 或amixer set Master 3dB- (音量下降3%)
工具
增減幅度本身設置,能夠加-c選項指定聲卡,好比個人是amixer set -c 0 Master 3%+,具體聲卡名能夠在打開alsamixer後按F2查看. spa
3.個人系統是archlinux,用i3桌面管理器,配置文件是主目錄下 .i3/config 文件,這個文件是根據 /etc/i3/config生成的.編輯器打開後,在最後加入: 命令行
bindsym XF86AudioRaiseVolume exec amixer -c 0 set Master 3%+ bindsym XF86AudioLowerVolume exec amixer -c 0 set Master 3%-
注意那個中間那個exec不要忘了,我一開始就是忘了加,產生了下面的錯誤: debug
ERROR: Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'shmlog', 'debuglog', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'unmark', 'resize', 'rename', 'nop', 'scratchpad', 'mode', 'bar' ERROR: Your command: amixer -c 0 set Master 3%+
4.重啓X後應該就生效了,i3能夠用默認的快捷鍵$mod + shift +r 從新加載配置,之後你就能夠直接用鍵盤控制音量了.
又覓了一更簡單的方法,此法用的是xbindkeys.
1. 安裝xbindkeys
archlinux下,
#pacman -S xbindkeys2.配置
在home下生成.xbindkeysrc
$ touch ~/.xbindkeysrc能夠用命令生成一個簡單的內容:
$ xbindkeys -d > ~/.xbindkeysrc打開這個文件,加入這些東西:
"amixer sset Master 4-" XF86AudioLowerVolume "amixer sset Master 4+" XF86AudioRaiseVolume
3.開機啓動xbindkeys
我是在.xinitrc最後加入一句xbindkeys .下次開機就能夠用了。如今你也能夠終端輸入xbindkeys,以後功能鍵就生效了.