Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: Some multimedia keys not working
Date: Thu, 06 Jan 2011 03:04:38
In Reply to: [gentoo-amd64] Some multimedia keys not working by Clemente Aguiar
Clemente Aguiar posted on Wed, 05 Jan 2011 15:39:18 +0000 as excerpted:

> I have a Microsoft Wireless Multimedia Keyboard 1.0A, and some of the > multimedia keys are not working in Gnome, for instance the "My > Documents", "My Images", "My Music), etc. > > I see that there are definitions for these keys for microsoftmult > in /usr/share/X11/xkb/symbols/inet, however when I check the keyboard > settings with the following command it does not seem to be using them. > > # setxkbmap -print -verbose 10 > Setting verbose level to 10 > locale is C > Applied rules from evdev: > rules: evdev > model: microsoftmult > layout: pt > options: grp:alts_toggle > Trying to build keymap using the following components: > keycodes: evdev+aliases(qwerty) > types: complete > compat: complete > symbols: pc+pt > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle) > geometry: pc(pc104) > xkb_keymap { > xkb_keycodes { include "evdev+aliases(qwerty)" }; xkb_types { > include "complete" }; > xkb_compat { include "complete" }; > xkb_symbols { include "pc+pt > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle)" }; > xkb_geometry { include "pc(pc104)" }; > }; > > How do I configure this keyboard correctly?
Try running xev (emerge it if necessary, it's a tiny app) from a terminal window. This should popup a small X window with a smaller window inside. When it has the focus, you'll get a running list of "X EVents" (thus xev) on its STDOUT -- the terminal window. These will include mouse movement and clicks, keyboard keypress/release events, window focus/unfocus events, etc. Of course what we're interested in here are the keyboard events... FWIW, I have a Logitech media/inet cordless keyboard here[1], so I know the issues with extra keys, altho I run KDE as when it comes to my computer I'm a control freak (so Gentoo's perfect for me! =:^), and KDE allows more in depth customization -- including both kde environment level and application level keyboard acceleration customization -- than Gnome tends to. Anyway, the first thing you need to do is to make sure X is recognizing the "extra" keys and returning appropriate key-names. Here's an excerpt from xev's output as I hit (actually release) one of mine (indent modified slightly to avoid line-wrap as posted): KeyRelease event, serial 33, synthetic NO, window 0x4400001, root 0x111, subw 0x0, time 824814070, (75,95), root:(79,1915), state 0x0, keycode 180 (keysym 0x1008ff18, XF86HomePage), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False See that XF86HomePage? That's the name that key is assigned. Here's a similar event for the escape key (no indent mod needed, escape is short enough it doesn't extend the line far enough to wrap): KeyRelease event, serial 34, synthetic NO, window 0x4400001, root 0x111, subw 0x0, time 824817164, (75,95), root:(79,1915), state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, XLookupString gives 1 bytes: (1b) " XFilterEvent returns: False Given that your posted setxkbmap settings say microsoftmult and include inet(evdev), there's a good chance xev will report the extra key events with registered keynames. FWIW, with newer xorg and evdev (I'm running ~amd64 plus some stuff from the x11 and kde overlays), you shouldn't even need microsoftmult -- my model is reported simply as pc101, but symbols include inet(evdev) and everything "just works" now, unlike years ago when I remember having to figure out what new rules I needed and fix all my shortcuts to work with the new names, as an upgrade had broken the old ones. Once you see that xev is recognizing and reporting the keys, it /should/ be a simple matter of setting up keyboard shortcuts appropriately to use the names xev reports. I know it's simple enough to do on kde, but gnome... isn't known for making keyboard shortcut customizations (among others) as simple and straightforward as it might, one of the reasons I strongly prefer kde, and don't have gnome on my system (tho I do have gtk +, for pan and firefox). But the first thing to find out is whether xev's seeing the keys and what they're called. (I've had names for the same keys change out on me before, as I upgraded, tho with evdev they seem to be getting more standardized and stable.) If xev doesn't have names registered or doesn't see the key at all, it's an X/evdev level (or lower, kernel) key-mapping issue. If xev is reporting the keys properly, it's a desktop environment and/or hotkey-app mapping issue. FWIW, if gnome's hotkey mapping isn't sufficient for you, take a look at xhotkeys (not in the tree, apparently) and x11-misc/xbindkeys (this one can take a simple or advanced config, with the advanced config using guile scripting so you can do things like check delay to do something different with a long vs short keypress, or multiple key sequences). Both of these are environment independent. I researched them as a result of a still unfixed regression in multi-key recognition between kde3 and kde4, but only the guile-scripted mode of xbindkeys would have been advanced enough for what I needed, and as I was trying to absorb that, I realized that I could do very close to the same thing using a khotkey single-key trigger to launch a custom bash script to catch the second key, and since I already know bash reasonably well, I went that way rather than trying to learn guile to get xbindkeys doing what I wanted. There's also gtkhotkey, which might be more appropriate for gnome users, but the Gentoo one-line description says it's a library, and the homepage is launchpad, without any reasonable description I can find, so I don't know if it includes a hotkey app that can be run or if it is indeed just a library, to be used by (other) apps. ---- [1] I tried an MS cordless keyboard/mouse at some point but was frustrated with it. I'm guessing that the MS drivers include some sort of Tx gain control for the keyboard, and that without those drivers, it defaulted to low-power on Linux. Or maybe I just got a bad one -- it happens. All I know is that I had a terrible time with it as even with the receiver right next to it, it would often have trouble detecting keys. So I went back to Logitech, which has always worked well. -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman


Subject Author
Re: [gentoo-amd64] Re: Some multimedia keys not working Clemente Aguiar <ca-lists@××××××××××××××××.pt>