Do you use let's encrypt?





9017 votes ~ 30 comments

 

Using special keys on multimedia keyboards

Posted by Steve on Sun 5 Dec 2004 at 15:04

If you are using a recent keyboard under X you likely have a bunch of strange multimedia keys which are going to waste.

These keys tend to be based upon media players. So they'll be marked next, stop, play, etc.

Here we're going to walk through hooking those up to work with xmms the multimedia player for X11, alternatively you could use them for the movie player xine instead.

Either of those, or other programs, can be invoked as a result of keypresses by using the xbindkeys package.

xbindkeys is a tool which allows you to invoke commands by pressing special keys, or key combinations like Alt + Up.

Install it as usual with apt:

apt-get install xbindkeys

It is configured by the use of a file ".xbindkeysrc" in your home directory.

The configuration file contains a repeated collection of two things: the keypress which it should listen for, and the associated command to run.

Here is an example of configuring xmms:

# Next Track - Alt + Up
"xmms --fwd"
   m:0x8 + c:98

# Previous Track - Alt + Down
"xmms --rew"
   m:0x8 + c:104

Here we have two keybindings and two commands. (The command comes first which is a little suprising).

The sample is pretty readable, it has the command to be executed enclosed in quote characters, then a line later the keyboard codes which will cause that command to be executed.

The only thing that makes little sense is the keyboard definitions, but thankfully the tool itself will tell you what you need to use for each key upon your keyboard.

To find out the keycode you must run:

xbindkeys -mk

This will pop up a window and show the keyboard codes when you hit keys - pressing "q" or closing the window will cause the program to exit.

For example holding down Alt and pressing "Pause" shows this:

"NoCommand"
    m:0x8 + c:110
    Alt + Pause

If you wish to cause this combination to run a command simply paste that section into your configuration file ~/.xbindkeysrc and replace the "NoCommand" with the command you wish to run.

Once you've setup the file to your needs you can start the program when you login, or just now, by running:

xbindkeys &

This runs the command in the background causing it to listen for keyboard events and execute the commands it knows about when it finds a combination listed in its configuration file.

xmms has a bunch of useful command line options for starting and stopping, so it's great for wiring up to the multimedia keyboards. Other commands can be setup to run just for convienence.

For example I have Emacs run with Ctrl + Alt + e, via this snippet:

"/usr/bin/emacs"
    m:0xc + c:26

 

 


Re: Using special keys on multimedia keyboards
Posted by Arthur (212.112.xx.xx) on Sat 30 Apr 2005 at 22:30
[ View Weblogs ]
Something else that bears looking into is lineak, available in both testing and unstable.

[ Parent | Reply to this comment ]

Re: Using special keys on multimedia keyboards
Posted by cuco (195.28.xx.xx) on Wed 4 May 2005 at 15:08
You could also try hotkeys:
This program sits at the back and listens for the "special" hotkeys
 that you won't normally use on your Internet/Multimedia keyboards.
 The buttons perform their intended behaviors, such as volume up and
 down, mute the speaker, launch applications, etc. It has On-screen
 display (OSD) to show the volume, program that's being started, etc.
 .
 It features an XML-based keycode configuration file format, which
 makes it possible to define the hotkeys to launch any programs you
 want.

[ Parent | Reply to this comment ]

Re: Using special keys on multimedia keyboards
Posted by Anonymous (194.138.xx.xx) on Thu 5 May 2005 at 13:36
Also fnfx does a good job.
It has a server/client architeture.
Things like vol up/vol down can be ran in the server part, while play, rew.... can be in client.

The server is also used to define the keys.


Note that on powerpc arch there is the great package pbbuttons and the fe gtkpbbuttons

[ Parent | Reply to this comment ]

Re: Using special keys on multimedia keyboards
Posted by Anonymous (194.138.xx.xx) on Thu 5 May 2005 at 13:39
you should search for fnfxd and fnfx-client if you want a binary package. Otherwise search fnfx

[ Parent | Reply to this comment ]