Xbindkeys is a program that enables us to bind commands to certain keys or key combinations on the keyboard. Xbindkeys works with multimedia keys and is window manager / DE independent, so if you switch much, xbindkeys is very handy.
Xbindkeys is available in the extra repository:
# pacman -S xbindkeys
Create a file named Template:Filename in your home directory:
Now you can either edit Template:Filename to set keybindings, or you can do that with the GUI.
To see the format of a configuration file entry, enter the following command:
A blank window will pop up. Press the key(s) to which you wish to assign a command and xbindkeys will output a handy snippet that can be entered into Template:Filename. For example, while the blank window is open, press Alt + o to get the following output (results may vary):
"(Scheme function)" m:0x8 + c:32 Alt + o
The first line represents a command. The second contains the state (0x8) and keycode (32) as reported by Template:Codeline. The third line contains the keysyms associated with the given keycodes. To use this output, copy the three lines to Template:Filename and replace "(Scheme function)" with the command you wish to perform. Here is an example configuration file that binds Fn key combos on a laptop to Template:Codeline commands that adjust sound volume. Note that pound (#) symbols can be used to create comments.
# Increase volume "amixer set Master playback 1+" m:0x0 + c:123 XF86AudioRaiseVolume # Decrease volume "amixer set Master playback 1-" m:0x0 + c:122 XF86AudioLowerVolume # Toggle mute "amixer set Master toggle" m:0x0 + c:121 XF86AudioMute
If you installed the xbindkeys_config package, just run:
Once you're done configuring your keys, edit your Template:Filename and place
before the line that starts your window manager or DE.