This is an old revision of the document!
Xbindkeys
Table of contents
- Introduction
- Installing
- Configuration and detecting key codes
- Examples of functions
- References
Introduction
Xbindkeys is a program that allows you to launch shell commands with your keyboard or your mouse under X Window. It links commands to keys or mouse buttons, using a configuration file. It's independant of the window manager and can capture all keyboard keys (ex: Power, Wake…).
It is useful to make “dead keys” of a multimedia keyboard work. (ex: play, pause, browser homepage…)
Installing
Use tazpkg to quickly install xbindkeys package. Open a terminal as root and type:
# tazpkg get-install xbindkeys
Current package is xbindkeys-1.8.3.
Configuration and detecting key codes
Xbindkeys uses a configuration file to link a command to a key on your keyboard. Usually this file is : $HOME/.xbindkeyrc
You can have a default one created by using :
$ xbindkeys --defaults > $HOME/.xbindkeysrc
Start the program using:
$ xbindkeys
To add a custom keyboard shortcut, first you have to detect the key code. To do this, use:
$ xbindkeys -k
When a small white window shows up on screen, just press the desired key. Terminal will show you the 3-line code of the pressed key. Example:
"(special function)" m:0x10 + c:180 Mod2 + XF86HomePage
Now, close xbindkeys application to make changes of configuration file:
$ killall xbindkeys
Open .xbindkeysrc file on Leafpad and copy the 3-line code above to the end of the file. We need to change the first code line to link the key code to a desired function. For example, we want that Leafpad be openned when the XF86Homepage key is pressed. To do this, just change the first line to:
"leafpad" m:0x10 + c:180 Mod2 + XF86HomePage
Save and close the .xbindkeysrc file. Restart xbindkeys program and your new shortcut is already working! To add other shortcuts, repeat the proceeding above. To detect a multi-key shortcut code, like CRTL+F, use:
$xbindkeys -mk
To be continued… Please, don't modify this page yet.