What we'll do is use two keyboard shortcuts to Rise and Lower the Master channel (general volume), making use of the amixer command-line tool.
Step 1: What DE do you use? Do you know how to add a new keyboard shortcut?
Gnome/KDE - In preferences (or in the Control Center) you'll find the Keyboard Shortcuts configuration GUI.
Xfce - In Settings > Keyboard > Application Shortcuts you'll find the GUI.
LXDE (openbox) - You can add a line in ~/.config/openbox/rc.xml - Run: (vi/vim text editor for experienced users)
Code: Select all
nano ~/.config/openbox/rc.xml
Code: Select all
nano ~/.fluxbox/keys
If we're going to use Gnome, KDE or Xfce, we don't have to worry about it. The GUI will pick up the key combination when adding the keyboard shortcut.
If we're going to use Openbox (LXDE) or Fluxbox, we'll write the key combinations manually. If we want to use a special key (apart from letters, numbers, signs and combiantion keys like Control or Shift), we can use xev. How? Just run it:
Code: Select all
xev
We can also use the command showkey. More information in the Debian wiki page keyboard multimedia key codes. There's also some multimedia keys information in this tutorial.
(Note: keycodes for special keys has only been tested and proved under Fluxbox and Openbox this far; if anybody could test it under any other WM I would be very grateful)
Step 3: Adding the two new keyboard shortcuts
The two commands are going to be the same under any Desktop Environment or Window Manager.
To rise the volume (Master, by 5%)
Code: Select all
amixer set Master 5%+
Code: Select all
amixer set Master 5%-
Code: Select all
amixer set Master toggle
Gnome/KDE/Xfce - Add two new keyboard shortcuts as shown in step 1 and paste the two commands to execute, respectively. Enter the key or key combination that you want, by doing it when asked to do so.
Openbox (LXDE) - We'll add the two keyboard shortcuts as stated in step 1:
Code: Select all
nano ~/.config/openbox/rc.xml
Code: Select all
<keybind key="keybind">
<action name="Rise Master by 5%">
<command>amixer set Master 5%+</command>
</action>
</keybind>
<keybind key="keybind">
<action name="Lower Master by 5%">
<command>amixer set Master 5%-</command>
</action>
</keybind>
Here is an example:
Code: Select all
<keybind key="C-S-x">
<action name="Rise Master by 5%">
<command>amixer set Master 5%+</command>
</action>
</keybind>
<keybind key="C-S-z">
<action name="Lower Master by 5%">
<command>amixer set Master 5%-</command>
</action>
</keybind>
Fluxbox - We'll add the two keyboard shortcuts as stated in step 1:
Code: Select all
nano ~/.fluxbox/keys
Code: Select all
Key1 Key2 Key3 :Exec amixer set Master 5%+
Key4 Key5 Key6 :Exec amixer set Master 5%-
Here is an example:
Code: Select all
Mod4 r :Exec amixer set Master 5%+ ## Rise master volume by 5%
122 :Exec amixer set Master 5%- ## Lower master volume by 5% (special key - using xev)
Frequently asked questions: (will be filled up with questions asked on comments)
That's it, guys. I hope you like it. So far, this has been fully tested under Fluxbox and Openbox. If you try it under any other DE/WM and it works, please let me know. I am also open to any suggestions or corrections and improvements upon my work.