Special key assignments

:)I want to assign two “unused except by winblows” keys to functions. As an example, I want the “eject” function on my Dell Studio 17 laptop to issue an eject command. I assume this will require a bash script. The keycodes for the two buttons are 170 and 133 according to xev.

Where should it go and what should it say? I’ve done plenty of programming but that was all on applications. I’m in the learning process as far as system programming is concerned.

Thanks for any help
Tom

Oops, forgot some information.

openSUSE 11.2 x86_64, KDE 4.3.1

If you use kde, there is a section in the kde control center to handle such keys.
Otherwise, you can use xbindkeys .

Further info: The “eject” key scan code 170) is mapped to “XF86Eject” in /usr/share/X11/XKeysymDB, but pressing the key does not eject the CD. The “eject” command works in a cli.

What do I need to do to re-map the “eject” key to the command “eject”?

When I try to a new action in configure desktop…mouse & keyboard, it responds with the message “this key not supported in Qt” after pressing the “eject” key, yet xev says it’s 170.

I don’t remember how i did to have it working but you may use this :
http://susewiki.org/index.php?title=Multimedia_Keys
keyTouch

There are also a lot of tutorials and forum topics about this.

About you eject key, i don’t have kde4, but kde3. In kde4 there must be some place in the kde control center where you can bind your eject key to a script or a command with the “eject” program, like it is possible in kde3. Otherwise, you can use xbindkeys .

I don’t remember how i did to have it working but you may use this :
http://susewiki.org/index.php?title=Multimedia_Keys
keyTouch

There are also a lot of tutorials and forum topics about this.

About your eject key, i don’t have kde4, but kde3. In kde4 there must be some place in the kde control center where you can bind your eject key to a script or a command with the “eject” program, like it is possible in kde3. Otherwise, you can use xbindkeys .

The wiki article sound good. The only problem for me is getting the xbindkeys package. It doesn’t seem to be in any of the Suse repo’s or repo’s for kde, packman or videolan. Looking with Google shows packages for some other distros but not for openSUSE. Any suggestions?

Thanks, Tom

It’s in the X11:Utilities repositories.
Use Software.openSUSE.org for a one-click install .

Thanks for the link. It worked, sorta.

Contents of ~/.xbindkeysrc:
“eject”
XF86Eject
“ps -ux”
Super_L
“kfind %u”
Alt_R

After running xbindkeys, hte “kfind” works but the other two don’t. I assume the “ps -ux” needs to bring up a terminal but does the “eject”?

I suppose you want the “ps -ux” to be executed in a terminal, so you may replace it by another command containing something with konsole (kde terminal) .

Does the eject command works now ?

And did you put an executable shell script in your .kde/Autostart/ directory, so that xbindkeys starts at each login under kde ? This script may be called start_xbindkeys and may contain something like :

#! /bin/bash
xbindkeys &