How do you Define Extra Keys for X?
baadpuppy asks:
"Ok, so I bought this nifty (and cheap)
keyboard that has 'Internet multi-media'
features: silly little buttons that do things
like BACK in your browser, and scrolling,
and controlling your CD and volume,
etc. It was only 19.95 and had a $10.00
rebate, so I figured 'what the heck,
it's only 10 bux wasted if I can't use them'.
I read keyboard howto, and got the keys
recognized by the Linux kernel, and
everything is groovy for console apps.
However, I spend 99.99999% of my time in X,
not at the console, so I want to make these
keys work in X. I have the list of scan
codes (the kernel was kind enough to list
them when it didn't recognize them). What
has to be done to make X understand them?
baadpuppy continues...
"I looked at the "XKB" extensions, and if there's any good documentation there, it's well hidden. I've downloaded the source code for the X server, and spent more than 5 hours perusing that code trying to figure out exactly where I might go about adding these keys!"
"I looked at the "XKB" extensions, and if there's any good documentation there, it's well hidden. I've downloaded the source code for the X server, and spent more than 5 hours perusing that code trying to figure out exactly where I might go about adding these keys!"
See what xev says when you press the keys. If it notices them, then you can use xmodmap to bind them to some keysym, and then tell your wm or apps to use this keysym. If you're lucky, xkeycaps will know about your keyboard, which makes the whole thing easier.
-al
June or July I think had an article on how to map those win95 keys to window manager functions. Works for an FVWM derivative WM. The following month had a KDE source patch to achive the same effect. Check that out and apply/extend the concepts.
Rick
rick@bart.phys.strath.ac.uk.earth.sol.milky-way
I dont know anything about PC but on Suns our keyboards have buttons like Stop, Again and Undo at the side of the keyboard. These keys work in Netscape and Emacs.
I'd like to map SHIFT-CTRL- to run a certain programs but I can't figure out how.
Does my window manager need to look for the combo and launch it or is there a generic way to set it up.
Actually I fine the windows keys to quite useful for "meta" in Emacs. In fact, I have a full complement of shift bits - shift, control, alt, altgr(language shift), meta, hyper, & super. Hop over to here to see my xmodmap map. Oh, one catch - it's for a dvorak layout :)
This says that the key generates the key code 125, which is currently mapped to the Help keysym. You can either try and find out how to assign the Help key to "back" in Netscape (probably by setting something in your X resources file), or you can use xmodmap to map this key to something that Netscape might already use to go back.
"The invisible and the non-existent look very much alike." -- Delos B. McKown
What I have done:
I used 'xev' to see if any events were generated for the extra keys. Only the MickeySoft keys generated any events. From my (admittedly limited) knowledge of the X event system, if the keyboard handler isn't generating a key pressed event, then nothing I do with xmodmap or xkeycaps is going to help. I first have to convince the X server's keyboard code to generate some kind of events for key presses of those keys.
Once that part is done, I'm fairly confident that I can deal with xkeycaps/xmodmap to make the keys actually useful (and yes, I intend to try to create the stuff for xkeycaps so others can use it later).
I suppose I'm a bit confused as to why X has to have it's own code to do hardware scancode conversion to software events, when (at least under linux) this seems like a kernel thing to do. I have my linux kernel being very happy about the extra keys, but X seems to just quietly ignore them. I fear I'll have to delve into the XKB extensions to get it to work.
Thanks for all the comments so far folx.
--
Infuriate left and right
xkeycaps man page implies that modifier keys are just that - modifiers. They can't do anything by themselves, they can only modify other keys' actions. Now you could redefine them as non modifiers...
--
Infuriate left and right
You could try just adding the keycodes to a file
and run xmodmap on it
The program you want is called xkeycaps. It lets you select a keyboard from a database of lots of different ones, and then writes out a file that is readable by xmodmap (the program that loads modifications to the keyboard map into X).
Get it at: http://www.jwz.org/xkeycaps/
So, just use xkeycaps to set up the keys to do whatever you want, save to a file (say, ~/.xmodmap-localhost) and put in your .xsession:
xmodmap ~/.xmodmap-localhost
You should read the xkeycaps man page after you install it, it sheds a lot of light about keyboards and how X handles keys. Good luck.