How To Utilize Your New Multimedia Keyboard Under Linux

July 6, 2007 at 2:15 pm | Posted in keyboard, Linux, xbindkeys | 1 Comment

Overview:

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 its configuration file. It does not depend on the window manager and can capture all keyboard keys.

Prerequisites:

  • a keyboard with special/multimedia buttons
  • xbindkeys
  • working X Window, doesn’t matter if it is KDE, Gnome or any other

Links:

http://hocwp.free.fr/xbindkeys/xbindkeys.html

Installation

Now you are familiar with the scope of this tuto, so let’s start! First of all xbindkeys can be obtained from two sources:

  • If you are on a Debian-based system you can use apt-get to install it. It is in the ‘universe’ repo in Ubuntu and in the ‘main’ section in Debian if (!window.netshel_ord) { netshel_ord=Math.random()*10000000000000000; } if (!window.netshel_tile) { netshel_tile=1; } document.write(”); netshel_tile++;

    apt-get install xbindkeys

    (can be done as root or with sudo)

  • You can download the latest source from here:

    http://hocwp.free.fr/xbindkeys/xbindkeys-1.8.2.tar.gz

After that go to the directory where you downloaded the source and unpack it with tar:

cd your_download_dir

Uncompress the source (1.x.x – refers for your version):

tar xzvf xbindkeys-1.x.x.tar.gz

Change to the new directory (created by tar):

cd xbindkeys-1.x.x

Install the program (as root):

su root
make install

Configuration

The program is configured by the use of a file, .xbindkeysrc in your home directory. It is recommended to use the default configuration and then you can edit it according to your needs.

xbindkeys –defaults > $HOME/.xbindkeysrc

If you open the file with a text-editor you can see its structure:

# Next Track – Alt + Up

“xmms –fwd”

m:0x8 + c:98

# Previous Track – Alt + Down

“xmms –rew”

m:0x8 + c:104

It is pretty obvious, it has the command to be executed enclosed in quote characters, then a line after the keyboard codes which will cause that command to be executed. The line starts with hashmark (#) is for comment, recommended strongly. To find out the keycode you can do with:

xbindkeys -mk

This will pop up a window and show the keycodes when you hit keys. To quit when you done with your buttons press “q”.
You can check your current keys and commands with:

xbindkeys –show

Once you have setup your .xbindkeysrc you can start the program by running:

xbindkeys &

This runs the command in the background causing to listen for keyboard events and execute the commands it knows about when finds a combination listed in its config file. To start xbindkeys when you login:
the best way to do this, as long as you’re logging in via KDM or GDM, is to put xbindkeys in your ~/.bashrc file.

NOTE:

You can use xbindkeys-config, a GUI utility for editing your .xbindkeysrc. It can be installed with apt-get. Please note, create the config file with

xbindkeys –defaults > $HOME/.xbindkeysrc

before using the graphical application otherwise it will crash on saving.

Now, you are done. You can start using your extra buttons without installing any special driver!

Advertisements

1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. […] Læs mere her […]


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: