The Story of SuSE 10.1, KDE and a Logitech MX3000 keyboard
This story begins with your writer getting sufficiently irritated with not having functioning multimedia keys on his Logitech MX 3000 cordless keyboard under SuSE 10.1
This article is as much for my own benefit as for anyone else. Mainly so I can find my "-ing" notes the next time I need to do this.
None of this is especially hard or earth shattering, it just doesn't seem to be all in one place on the 'Net.
Part the First: Event Codes
To enable the funky keys we need to find out what they are to the underlying X system. The tool xev is used for this.
Run xev from a console; press the individual keys; note the keycode number.
An individual event looks a bit like this:
KeyRelease event, serial 31, synthetic NO, window 0x3000001,
With these individual keycode you need to in turn "map" them using xmodmap. I created a simple script called keycodes.sh which is placed in the ~/.kde/Autostart directory to be enabled at kde startup.
Part the Second: KDE Integration
Having got these into KDE (you will probably need a KDE restart), we can now use khotkeys to create the bindings to actual events.
Personal Settings; Regional & Accessibility; Input Actions
I created a new Group at the top leve called MX3000. This gives me three Groups: "Examples", "Konqueror Gestures", and now "MX3000". It's under the MX3000 group that I've placed all my keyboard specific changes.
I've found that the DCOP integration to be the most effective, powerful and easist method of integrating keyboard keys. My earlier attempts used shell scripts. Clumsy and painful.
To do any one key is all pretty much identical, so I'll give the example of setting the mute button:
- Select the "MX3000" group.
- Click "New Action"
- Under the General tab, change the Action Name to Mute.
- Change the Action type to "Keyboard Shortcut ->DCOP Call (simple)
- Under the Keyboard Shortcut Tab, apply the correct key. If using my above script, that's F23
- The DCOP Call Settings tab is last:
- Remote Application: kmix
- Remote Object: Mixer0
- Called Function: toggleMute
- Arguments: 0
- Apply and that's it!
- You can click the try button to verify all works.
- The argument in the above example selects the first (zeroth) sound device. It may be another number.
- The Run KDCOP button is seriously cool. This opens a browser to all the DCOP whatevers. From here you can find all sorts of interesting things to hook into.
- eg. Open same, find kmix and follow the tree as described in the example to find the toggleMute function: void toggleMute(int deviceidx)
- you can select this function and drag into the "Called Function" text field as filled in above. Saves on typing, but does need some cleanup.
- VolumeDown; F21; kmix, Mixer0, decreaseVolume, 0
- VolumeUp; F22; kmix, Mixer0, increaseVolume, 0
I prefer Amarok for my music playing, YMMV.
- AmarokPlay; F19; amarok, player, playPause
- AmarokStop; F18; amarok, player, stop
- AmarokNext; F17; amarok, player, next
- AmarokPrev; F16; amarok, player, prev
None of these last 4 needs an argument, which you'll also see if you use the DCOP browser.
I haven't bothered with any of the other keys. Some don't register with xev, the LinEAK project has pretty good instructions on how to go about finding these if you're really keen.