Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
X GUI

How do you Define Extra Keys for X? 12

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!"
This discussion has been archived. No new comments can be posted.

How do you Define Extra Keys for X?

Comments Filter:
  • 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 [umass.edu] to see my xmodmap map. Oh, one catch - it's for a dvorak layout :)
  • First, you need to find the X keysyms for the keys. The easiest way to do this is probably to use xev. Move the cursor to the xev window, and press the key you want to know about. You should see a KeyRelease event, with a line like:
    state 0x0, keycode 125 (keysym 0xff6a, Help), same_screen YES,

    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.

  • I realize I should have included all the relevant data in the initial question.

    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.

  • This new computer of mine has one of these Lose95 104 key keyboards.
    1. How do I get X to recognize them? I don't see anything obvious in keysymdefs.h.
    2. FVWM's 'Key' function doesn't have any modifiers for these keys. Will I have to modify the sources? Probably trivial to add 'W' for instance, but I'd just as soon not if I don't have to.
    3. How about regular programs from then on? I suppose Xkeycaps would help, although I tried it. I don't know how to reference them, since X doesn't appear to recognize them.


    --
  • 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...

    --
  • 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/ [jwz.org]

    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.

The only possible interpretation of any research whatever in the `social sciences' is: some do, some don't. -- Ernest Rutherford

Working...