How to reconfigure keyboard via NeWS

Rob Warnock rpw3 at rigden.wpd.sgi.com
Fri May 4 19:25:06 AEST 1990


In article <1990May3.202512.18213 at agate.berkeley.edu>
larry at pylos.cchem.Berkeley.EDU (Raymond L. June) writes:
+---------------
| We have recently acquired a PI and use NeWS. While montioring this
| group for a couple of weeks, I have noticed the mention of a program
| called keyswap.ps to switch the control and capslock keys. However, who
| archives stuff like this for SG users (an internet address would be nice).
+---------------

I don't archive anything, but since I posted it once (copied from somebody
else's previous posting), I'll post it again... JUST THIS ONCE MORE!
(See below.)  [Note for those bored with this: I've answered several more
requests by email, maybe this posting will hold 'em for a while...]

+---------------
| Also, a way to increase the key repeat rate would also be nice - is there
| a parameter in /usr/NeWS/lib or somewhere to set this?
+---------------

Not yet. "The next release" has a command to do this...

-Rob


-----
Rob Warnock, MS-9U/510		rpw3 at sgi.com		rpw3 at pei.com
Silicon Graphics, Inc.		(415)335-1673		Protocol Engines, Inc.
2011 N. Shoreline Blvd.
Mountain View, CA  94039-7311

============== attachment: keyswap.info ========

In addition to mapping CapsLock to Ctrl, I also mappped NumLock
(which I *never* use) back to CapsLock (which I almost never use,
but still might like to occasionally). It's *way* out of the way,
and impossible to hit by accident. It's kinda cute to hit NumLock
and watch the CapsLock LED go on and off...

Put the following in your user.ps (at the end, say):

        { (NeWS/keyswap.ps) LoadFile
        %map CapsLock   =>   Cntl
        %            Numlock   =>  CapsLock
             [28420  28582] [28419 28420] replacekeys
         } stopped pop

Then put the attached file (below) in your ~/NeWS/keyswap.ps (or whatever
directory you use to keep things user.ps calls -- just remember to adjust
the call in user.ps if you move it). Log out and back in.

If you want to mess with other keys, note that the magic numbers given above
are 0x6F00 + "button number" from "/usr/include/device.h".

============= ~/NEWS/keyswap.ps ==================

% From: scotth at harlie.corp.sgi.com
%
%   Earlier, I posted some code to swap the functionality of the Caps Lock
% and left-hand Ctrl key.  I have now written some code to make key
% remapping more flexible.  This code is also better because Caps Lock was
% still Caps Lock for an instant in the old code.  It not does function as
% Caps Lock at all in this code.  If you put the following in your user.ps
% (and take out the stuff I sent out before, if you have it), you can make
% any IRIS key behave as any other.  This will only work under 3.1 however,
% so if you haven't upgraded, you may want to keep the old code until you
% do upgrade.

/replacekeys { % origkeyvals_array changedkeyvals_array -> -
    {
        /changedvals exch def
        /origvals exch def
        /keysdict origvals length dict def
        keysdict begin
            0 1 origvals length 1 sub {
                dup origvals exch get changedvals
                3 2 roll get def
            } for
        end
        createevent dup begin
            /Name origvals def
            /Priority 2 def
            /Exclusivity true def
        end
        expressinterest
        {
            awaitevent dup dup begin
                /Name get keysdict exch get /Name exch def
            end
            redistributeevent
        } loop
    } fork pop pop pop
} def



More information about the Comp.sys.sgi mailing list