Add new comment

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by bgmilne (registered user) on Wed, 2007-05-09 09:12.

It is unfortunate that that the author did not cover the technologies involved, and discuss all the possible solutions.

Both KDE and GNOME (not sure about other desktops) have comprehensive native support for multimedia keys. For both desktops, the only thing that you need to do is ensure that your keyboard layout is configured correclty. This is best done by setting the "XkbModel" option in Xorg.conf (as the X server is really the only thing that can know what keyboard model you have - especially if you use applications/X remotely, or have the same home directory on multiple machines).

 However, this does require that X knows what the keycodes should translate to - but in the end it is much more useful for people to contribute their keyboard definitions for X than waste time with workaround utilities (such as xbindkeys, lineak etc etc).

Quick howto for anyone using KDE with a keyboard X has a valid layout for:

1)Find correct keyboard layout (if you don't know it already). Start KDE Control Center, find the "Keyboard Layout" tool (under Regional & Accessibility on my Mandriva install running in English). Click the "Layout" tab, ensure that the "Enable keyboard layouts" option is checked, then select the a candidate from the "Keyboard model" drop-down box, and click Apply. Select the "Keyboard shortcuts" tool, and start creating a new shortcut, just so you can test the keys (and what Symbols they are sending). If the layout doesn't work with all your keys, repeat ...

2)Once you have found the right keyboard layout, return to the "Keyboard Layout" tool, click on the keyboard listed under "Active layouts" to see the command that was used (in the "Command" field). Take the value after the -model flag, and then add a XkbModel option to xorg.conf. In my case, my InputDevice section for my keyboard looks like this:

 Section "InputDevice"
    Identifier "Keyboard1"
    Driver "kbd"
    Option "XkbModel" "inspiron"
    Option "XkbLayout" "us"
    Option "XkbOptions" "compose:rwin"
EndSection

Restart X when it is convenient.

If you use the same home directory on multiple machines, uncheck the "Enable keyboard layouts" option in KDE Control Center (so that you don't set the wrong keyboard layout after X has started).

Note that on Mandriva, the keyboard configuration tool (drakkeyboard) can also be used to set this up, and if your hardware has a specific keyboard type the OS installer knows about (e.g. Dell Inspiron laptops), this should have been setup by default.

3)Now, return to "Keyboard shortcuts", and you can set up any global or command shortcuts. Also, you can use your multimedia keys from any KDE application with keyboard shortcut support (e.g. amarok, kaffeine, kmplayer etc.)

If you don't find a suitable model in step (1), this means that X does not have the information for your keyboard, the best thing to do is to update the keyboard map, and provide a patch to X.org for your keyboard. This can't be covered here, but see (for example) /usr/share/X11/xkb/symbols/inet (or similar, may differ on other distributions). Updating this is not difficult (just takes some patience).

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.