[comp.sys.sgi] How to reconfigure keyboard via NeWS

larry@pylos.cchem.Berkeley.EDU (Raymond L. June) (05/04/90)

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).
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? No, the industrial
sponsor didn't give use the manuals to the machine and getting an SGI 
sales rep to call you back is like pulling teeth on a alligator.

I'll take all replies and catalog them for future posts to anybody who
desires them. Email or net is fine.

Thanx, Larry June

+--------+-------------------------------------------------------------+
U.Snail: | Larry June, 201 Gilman Hall, Dept. of Chemical Engineering, |
         | University of California, Berkeley, Berkeley CA 94720       |
ATT:     | 415 642-5927 (worknet) 415 848-3705 (homenet)               |
Internet:| larry@pylos.cchem.berkeley.edu or zeorlj@violet.berkeley.edu|
+--------+-------------------------------------------------------------+

rpw3@rigden.wpd.sgi.com (Rob Warnock) (05/04/90)

In article <1990May3.202512.18213@agate.berkeley.edu>
larry@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@sgi.com		rpw3@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@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

kipp@warp.esd.sgi.com (Kipp Hickman) (05/05/90)

This postscript hack that switches the caps and control keys has been
known to kill wsh (rarely, but it doesn happen)....I believe there is
a subtle bug in the postscript

					kipp

mccalpin@vax1.acs.udel.EDU (John D Mccalpin) (05/05/90)

In article <7267@odin.corp.sgi.com> kipp@warp.esd.sgi.com (Kipp Hickman) writes:
>This postscript hack that switches the caps and control keys has been
>known to kill wsh (rarely, but it doesn happen)....I believe there is
>a subtle bug in the postscript.		kipp

I have not seen that happen, but I have seen a very annoying bug with 
declaring the backspace key to be "delete".  Occasionally when I hit
`backspace' in the vi editor it acts as if I have typed:  ESC h
The net result of which is to pop me out of insert mode and to back up
the cursor one space. This is extremely annoying, and I will probably
delete the patch soon to get rid of the bug....
Has anyone else seen this?
-- 
John D. McCalpin                               mccalpin@vax1.udel.edu
Assistant Professor                            mccalpin@delocn.udel.edu
College of Marine Studies, U. Del.             mccalpin@scri1.scri.fsu.edu