Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2005 23:11:18 -0600 (CST)
From:      Lars Eighner <eighner@io.com>
To:        Alejandro Pulver <alejandro@varnet.biz>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Using META and DEL keys in console
Message-ID:  <20050301220822.F8622@goodwill.io.com>
In-Reply-To: <20050301194338.3a49611d@ale.varnet.bsd>
References:  <20050301194338.3a49611d@ale.varnet.bsd>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 1 Mar 2005, Alejandro Pulver wrote:

> Hello,
>
> I have a PS/2 PC-101 keyboard.
>
> I would like to use my META (ALT in my keyboard) key instead of ESC in
> console mode. META works fine in an xterm. I also would like to use DEL
> and others.

The console keymaps are in /usr/share/syscons/keymaps.  You can edit
whichever keymap you are using with a flat ascii editor.

To get a key to send the familiar ^?, enter del in the keymap.
Not all applications, however, will do the expected thing with
this, and you will have to consult the documentation for the
individual applications to see whether they can be configured to
do what you expect from a delete key.  For backspace, bs, for
meta, meta, esc for escape.  Note that you can set the left and
right Alt keys to different things, and that keypad Del/. key
can be different from the Delete key.

You almost certainly do not want to mess with terminfo.

If you use the the bash shell, you can see
what a key is currently sending by entering C-v<keystroke>
at the command prompt.

> I read something in the manual pages of terminfo(5), gettytab(5),
> etc.
>
> I tried the following options:
>
> :km:smm:dc:
>
> But I am having these thoubles:
>
> 1) My ALT key did not work and the DEL key acts as BACKSPACE (C-h),
>   but I would like to use it as C-d.

C-d is eot in the console keymap if you would rather have that
than the ^? which is del.


> 2) Some strange thing happens with Emacs in console mode: when I press
>   DEL, it is interpreted (literally) as C-h, and C-h is used as
>   BACKSPACE. And C-d acts as DEL.

Switching to the emacs keymap might help you.


> 3) Also DEL does not do anything in xterm.

Make changes to xterm mappings in your .Xdefaults file, such as:

!! xterm keymappings
*XTerm*VT100.translations:      #override \n\
         <Key>KP_Delete: string(0x7f) \n\

Naturally, you can make these strings whatever you want.

> Is there a more descriptive documentation of the terminal capabilities
> listed in terminfo(5)?

Yes, you can google for many books worth of material, but it is
not particularly germane to what you want to do if you are running
a PC with a PC keyboard, and not trying to connect some ancient
dumb terminal.

> Is there a standard configuration for PS/2 PC-101 keyboards?

Unfortunately there are a lot of them.


> Does xterm use a different configuration from console terminals?

Yes.

X applications are meant to run on X, and X is meant to run on a
variety of machines.  Any relationship between xterm and the
machine's native terminal is purely coincidental.  (In
particular, xterm is meant to be out of the box compatible with
the very old VT100 standard - which never was native to any PC
operating system.) You can get xterm and the console keyboard to
behave mostly the same way - and get that way to be what you
want - by editing .Xdefaults and the syscons keymap you are
using (probably both).  But that doesn't mean that every
application will behave as you think it should.

-- 
Lars Eighner
eighner@io.com
http://www.io.com/~eighner/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050301220822.F8622>