[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new computer



 From          : klug>klug-request
 To            : adam
 Subject       : Re: new computer
 Date          : 09/29/99 19:24


>> 106 KEY WINDOWS 98 KEYBOARD
>> Great.  Did you know you can program those extra keys in X as well?
>I did not know that!  Any idea where I can find some info on this?  I've
>got all kinds of cd control buttons, etc that I would like to try to find
>a use for (pop open an aterm, netscape, etc).  Plus those two down there
>between Ctrl and Alt are pretty useless :)

X11 has several layers of abstraction that you need to adjust to do this.
For example, pressing F1 in the xev window produces:~

KeyPress event, serial 21, synthetic NO, window 0x2400001,~
    root 0x26, subw 0x0, time 2387188408, (-7,11), root:(608,426),~
    state 0x0, keycode 67 (keysym 0xffbe, F1), same_screen YES,~
    XLookupString gives 0 characters:  ""~

Note the keycode is 67,  you can think of this as the signal sent from the
keyboard to the computer, "Someone pressed Key #67",  X has a translation
table call the "keysym" table that translates #67 to F1 (or 0xffbe).  It does
this because diffrent computer keyboards may have diffrent numbers of
function keys,  or some have a seperate caps lock vs. alpha lock
(commodore) or a numeric keypad structured in a diffrent way (NCD).
These layers are so X can be "easily" adpated to all such environments,  and
the app just says "When you press F1 I'll do X function" without concerning
itself with what your F1 key looks like, is labeled as, or is located on the
keyboard.~

One other example is,  one of my UNIX savy data entry people does the
following:~

xmodmap -e "keycode 82 = t"~
xmodmap -e "keycode 86 = r"~

Because he is constantly entring MCFA part numbers which are in the form
of #(t or r)#####,  and the above maps the keysysms t and r to two of the
match keys on the keypad (/ or * or - or +),  and he can then enter the
numbers in a continuous stream withou ever taking his hand of the keypad.  I
also have a xmodmap string in my Xsetup_0 file that maps the numeric keypad
to be numeric regardless of the state of Num-Lock.~

/usr/X11R6/bin/xmodmap -e "keysym KP_Divide = slash"~
/usr/X11R6/bin/xmodmap -e "keysym KP_Decimal = period"~
/usr/X11R6/bin/xmodmap -e "keysym KP_Add = plus"~
/usr/X11R6/bin/xmodmap -e "keysym KP_Subtract = minus"~
/usr/X11R6/bin/xmodmap -e "keysym KP_Multiply = asterisk"~
/usr/X11R6/bin/xmodmap -e "keysym KP_Enter = Return"~
/usr/X11R6/bin/xmodmap -e "keysym KP_0 = 0x30"~
/usr/X11R6/bin/xmodmap -e "keysym KP_1 = 1 F13 F22"~
/usr/X11R6/bin/xmodmap -e "keysym KP_2 = 2 F14 F23"~
/usr/X11R6/bin/xmodmap -e "keysym KP_3 = 3 F15 F24"~
/usr/X11R6/bin/xmodmap -e "keysym KP_4 = 4 F16 F25"~
/usr/X11R6/bin/xmodmap -e "keysym KP_5 = 5 F17 F26"~
/usr/X11R6/bin/xmodmap -e "keysym KP_6 = 6 F18 F27"~
/usr/X11R6/bin/xmodmap -e "keysym KP_7 = 7 F19 F28"~
/usr/X11R6/bin/xmodmap -e "keysym KP_8 = 8 F20 F29"~
/usr/X11R6/bin/xmodmap -e "keysym KP_9 = 9 F21 F30"~

It also lets me use the numeric keypad in a "shifted" state to simulate
function keys F13 - F30,  which to not exist on my IBM PC-101 keyboard.~


My notes show that Windows key left, right are keycodes 115 & 117
respectively.  If you confirm that let me know,  as I have no Windows
keyboards,  and just copied that down from some Usenet post.