colinrmitchell.com

Blog

X11 Key Bindings

Posted Wednesday, November 19th 2014 in FreeBSD, Linux - Permalink

To get key bindings in X11 when you do not have a window manager installed that supplies this, you can install xbindkeys.

# pkg install xbindkeys

Create a config file in your home directory,

% touch ~/.xbindkeysrc

To configure a key or key chord, you can use the following command. Simply run the command, press the key or key chord you want, and the program will display the code for it and exit. E.g.,

% xbindkeys --key
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
^[[24~"(Scheme function)"
    m:0x0 + c:96
    F12
%

The second to the last line in the output is the keycode. Now, you simply add a line to the config file you created. For example, I like to set F10, F11, and F12 to control my music player:

"rhythmbox-client --next"
  m:0x0 + c:95
 
"rhythmbox-client --previous"
  m:0x0 + c:76
  
"rhythmbox-client --play-pause"
  m:0x0 + c:96

Now you can simply restart the program, and your keybindings should work!


List Posts Newest Posts Page 1Next Page