Using the extra keys on the keyboard

OpenSuse 11.0, KDE 4.1, Logitech Media Keyboard nearly identical to Logitech Media Keyboard Elite, trying to get all or most of the extra keys to work.

According to the hardware-wiki page the Elite is identical to the Logitech Cordless Desktop LX-300 so I selected that as the keyboard layout in YaST and restarted the computer.

Then I read SDB:Using the Extra Keys on the Keyboard, opened xev, hit the calculator button, and was astonished to see

KeyPress event, serial 34, synthetic NO, window 0x3000001,
    root 0x188, subw 0x3000002, time 1130010, (54,33), root:(1151,874),
    state 0x10, keycode 161 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x3000001,
    root 0x188, subw 0x3000002, time 1130221, (54,33), root:(1151,874),
    state 0x10, keycode 161 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

appear, but no calculator window. This would indicate that the keycodes are already programmed (in this case, keycode 161 = XF86Calculator), but for some reason do not function in the desired manner.

So I opened /etc/X11/Xmodmap and found that it is only comments (every line begins with !).

There is a note in the file that reads “The system Xmodmap is /usr/X11R6/lib/X11/Xmodmap”, however I cannot find this file on my computer (there is no such folder /usr/X11R6/lib/X11).

The forward, back, favorites, and home keys work, but not volume up, volume down, mute, search, or calculator (I haven’t tried the others, and search isn’t a big deal, I’m not sure what exactly it’s supposed to be searching for anyway).

I’m not sure where to go from here.

Probably it’s called XF86Calculator simply because of the calculator logo on it and the XF86 group just wanted to give it a symbolic name. It doesn’t imply that any action or program is bound to it by default; you have to arrange that yourself. Sorry, I haven’t tried to do this but I’m sure something can be arranged. Good luck.

PS: There is a Menu key next to my right Ctrl but it doesn’t popup a menu. I have however bound it to Compose, for entering characters with diacritics.

So how does one go about binding KCalc to XF86Calculator?

On Sat, 16 Aug 2008 03:06:03 GMT
djmonkey1 <djmonkey1@no-mx.forums.opensuse.org> wrote:

>
> So how does one go about binding KCalc to XF86Calculator?
>
>

I believe the program ‘lineak’ will do what you’re looking for, it allows
configuring extra keys and binding them to programs.

Should be able to find it through YaST, there are several packages listed.

Loni


L R Nix
lornix@lornix.com

Lineak is a program for mapping keycodes. The keycodes for my keyboard are already mapped.

For instance, the “Home” button is bound to “XF86HomePage”. Pressing the “Home” button when a browser window is open results in that browser going to the home page (works in Firefox, Konqueror, and Dolphin). So, XF86HomePage must be defined somewhere in some configuration file.

However, apparently XF86Calculator is not defined, or is defined wrong, or at least in some way that doesn’t work the way I expect it to.

What are these XF86Codes? Are they kernel events, system commands, etc? Where are they defined?

They are just symbolic names for the numeric values for the convenience of mapping programs (easier to deal with names than numbers). Nothing more is implied by the name. You have to have some X11 program interpret the code to actually do something.

In /etc/icewm/keys there is

# This is an example for IceWM's hotkey definition file.
#
# Place your variants in /etc/icewm or in $HOME/.icewm
# since modifications to this file will be discarded when you
# (re)install icewm.
#
# A list of all valid keyboard symbols can be found in
# /usr/include/X11/keysym.h, keysymdefs.h, XF86keysym.h, ...
# You'll have to omit XK_ prefixs and to replace XF86XK_ prefixes by
# XF86. Valid modifiers are Alt, Ctrl, Shift, Meta, Super and Hyper.
#
key "Alt+Ctrl+t"		xterm
key "Alt+Ctrl+f"		fte
key "Alt+Ctrl+e"		nedit
key "Alt+Ctrl+g"		gimp
key "Alt+Ctrl+n"		netscape -noraise -remote openBrowser
key "Alt+Ctrl+b"		netscape -noraise -remote openBookmarks
key "Alt+Ctrl+m"		netscape -noraise -remote openURL(mailto:,new-window) 

key "Alt+Ctrl+KP_Divide"	aumix -v -5		# lower volume
key "Alt+Ctrl+KP_Multiply"	aumix -v +5		# raise volume

# "Multimedia key" bindings for XFree86. Gather the keycodes of your
# advanced function keys by watching the output of the xev command whilest
# pressing those keys and map those symbols by using xmodmap.

key "XF86Standby"		killall -QUIT icewm
key "XF86AudioLowerVolume"	aumix -v -5
key "XF86AudioRaiseVolume"	aumix -v +5
key "XF86AudioMute"		aumix -v 0
key "XF86AudioPlay"		cdplay play 1
key "XF86AudioStop"		cdplay stop
key "XF86HomePage"		netscape -noraise -remote openHomepage
key "XF86Mail"			netscape -noraise -remote openURL(mailto:,new-window) 
key "XF86Search"		netscape -noraise -remote openURL(http://www.google.com/)
key "XF86Eject"			eject

I’ve tried editing it to no effect as well as making the mods in /Home/.icewm/

Most of the shortcuts defined in this file don’t work, and some that do work aren’t defined here, so it would seem this file isn’t used by the system or is superseded by another.

Well that looks like an old map, I don’t know who uses netscape any more. If the program doesn’t exist, then icewm can’t invoke it. You might try looking in icewm’s log file (whereever it may be, sorry I don’t use icewm so I don’t know) to see which keys work and which ones don’t.

Before I just looked it up just now I didn’t even know what IceWM was. I take it’s not used with openSuse 11 and KDE 4.1 then? Why are there files related to it installed with the system? What is used instead? How can I find out? Does it have a keys file? Can it? Should it?

Icewm is a window manager as the name implies. It is used instead of KDE or GNOME by people who want a simple, lightweight windowing environment. There are lots of other WMs, icewm is just one of the better known ones. OpenSUSE contains packages for icewm, and you can switch your session to icewm at login if you want. I don’t know why that file is installed on your system. Perhaps the icewm packages are installed, just not in use by you.

I was under the impression that you were an icewm user.

But moving away from that red herring, a search with the terms “kde key bind run command” got this hit:

The Linux Desktop Invasion: Efficiency with keybindings

which seems to suggest binding a shell command to a key is easy in GNOME but not directly possible in KDE (you have to Run command, then type in the command). I didn’t look any harder so maybe they are wrong and there is some way.

Why don’t you try with keytouch and keytouch-editor?

I’ve played around with my system and now have KDE 3.5 and 4.1 installed.

All of the media keys work out of the box with 3.5, but only some work with 4.1. At this point I’m thinking it’s a bug.

Bug 398354 - Shortcut Audio keys not working (work fine in openSUSE-10.3)

Bug 404637 - Missing and forgetting key assignments

Also, IceWM is installed along with KDE (learning, learning, always learning) and it’s very easy to add/edit key settings like these by editing /etc/icewm/keys.

It’s also pretty easy to edit these settings in KDE 3.5. Go to K Menu->Configure Desktop/Personal Settings->Regional & Accessibility->Input Actions->Preset Actions. For instance I was able to change the behavior of the E-Mail key to open Thunderbird instead of a KMail compose window. There are other shortcuts defined under Keyboard Shortcuts.

There is a similar menu in KDE 4.1 but the shortcuts defined there don’t work (this must be one of the things that isn’t quite done yet).