[comp.unix.questions] keyboard remapping: help!

mcb@oddjob.UUCP (01/26/87)

Does anyone know of a good way to remap a terminal (sun especially) to the
Dvorak layout?  The idea is simple: all you have to do is replace all b's
with x's, and so on.  The problem I'm having is that some programs seem to
take input directly from the terminal (so I can't pipe stdin to them through
a filter).

Please mail any ideas to me.  Thanks in advance,
                                 -Matt Bamberger

gwyn@brl-smoke.UUCP (01/28/87)

In article <1636@oddjob.UChicago.EDU> mcb@oddjob.UChicago.EDU.UUCP (Matt Bamberger) writes:
>Does anyone know of a good way to remap a terminal (sun especially) to the
>Dvorak layout?  The idea is simple: all you have to do is replace all b's
>with x's, and so on.  The problem I'm having is that some programs seem to
>take input directly from the terminal (so I can't pipe stdin to them through
>a filter).

This won't help Matt in the immediate future, but it is worth noting
that this problem seems ideally suited for a streams module, whenever
the terminal handler finally gets converted to streams.  I suspect a
similar approach could help deal with strange displays (Kanji, etc.).

guy@gorodish.UUCP (02/01/87)

>Does anyone know of a good way to remap a terminal (sun especially) to the
>Dvorak layout?  ...The problem I'm having is that some programs seem to
>take input directly from the terminal (so I can't pipe stdin to them through
>a filter).

Well, in part it depends on what you mean by "Sun, especially" here.
If it's a Sun workstation, the "terminal" you use is a 68K-based
machine running SunOS, so there are some non-standard things you can
do (i.e., you might be able to do the equivalent of changing the
terminal firmware, since that equivalent is a combination of kernel
code and a user-mode program).  In fact, in the general case you
*have* to do this, since applications not run from within a shell or
command window don't see anything resembling a terminal or terminal
driver; the kernel window system code reads from the keyboard and
feeds the events to the appropriate "/dev/win*" device.

There is an admittedly rather opaque description of key mapping in
section 4 of the Sun UNIX manuals.

If you're talking about terminals plugged into serial ports, one or
more of the techniques mentioned (modifying the terminal driver or
pushing a streams module onto it, and using a pseudo-tty) are
available, depending on what the OS on the machine in question
supports.  There are pros and cons to both approaches, but the point
that would clinch the argument at present would probably be which
techniques were possible under the OS in question.

mouse@mcgill-vision.UUCP (02/05/87)

In article <1636@oddjob.UChicago.EDU>, mcb@oddjob.UChicago.EDU (Matt Bamberger) writes:
> Does anyone know of a good way to remap a terminal (sun especially)
> to the Dvorak layout?  The idea is simple: all you have to do is
> replace all b's with x's, and so on.  The problem I'm having is that
> some programs seem to take input directly from the terminal (so I
> can't pipe stdin to them through a filter).

The idea is simple, but the implementation usually is not.  This can't
be done with a normal terminal, because (for example) control-comma and
control-period can't be distinguished, so you can't put letters on
those keys.  About all you can do is rearrange the letters.  It is
fairly easy to put code in the terminal driver to accomplish this.

If you are lucky enough to be on a machine with a completely soft
keyboard like a Sun or a Lisp Machine then this becomes possible.  You
have to write something that tells the kernel to give it raw up/down
keycodes and does its own keyboard interpretation and feeds it to your
program (shell, whatever) through a pseudo tty.  This is relatively
easy; I have a program which does this (among other things) on the Sun.

There are problems though.

One is Sun-specific:  such a program doesn't get along with suntools,
since suntools thinks it owns the keyboard.  I look upon this as yet
another reason not to run suntools.

The other is general:  you'd better know the new layout better than the
old, unless you rearrange the keycaps.  I know; there was a time when I
did rearrange my keyboard in an effort to teach myself a more efficient
layout.  Couldn't do it, even with the help of a little cheat sheet
showing the new layout sitting right by the keyboard.  I don't know how
easy it would be if the keycaps matched (no opportunity to try it).
What I'd like to see would be a terminal with little (say) 10x20 arrays
of LEDs (or LCDs) instead of symbols on the keycaps.  These would then
of course be programmable.  (I know, it'd be a mess to connect the
keycaps to the electronics - but it *would* be nice, wouldn't it?)

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu