[Urwid] Problem with Alt/Meta key

Rebecca Breu rebecca at rbreu.de
Fri May 5 09:08:41 EDT 2006


Hi!

I have a problem using the Alt key (Meta key). I'm not sure if
urwid is to blame, but I will desribe the problem anyway.

When I run the input_test.py on i368 machines with Linux
(I tried Debian, Suse and Gentoo), pressing Alt+<key> results
in the output of 'meta <key>' on the screen, just as I expect
it.

With non-Linux operating systems or non-i386 machines, the Alt key
won't work with urwid.


Example (SunOS/sparc-machine):
xev says that pressing the Alt key results in
keycode 26 (key sym 0xffe9, Alt_L)

According to xmodmap, that should trigger the mod1 Modifier:

shift       Shift_L (0x6a),  Shift_R (0x75)
lock        Caps_Lock (0x7e)
control     Control_L (0x53)
mod1        Alt_L (0x1a)
mod2        Mode_switch (0x14)
mod3        Num_Lock (0x69)
mod4        Meta_L (0x7f),  Meta_R (0x81)
mod5        F13 (0x20),  F18 (0x50),  F20 (0x68)

But in input_test.py, it doesn't. For example Alt+q produces the
spanish charakter n with a ~ on top of it. The *only* way to
get input_test.py to display 'meta q' is pressing the escape key
and then 'q', but you have to be *very* fast.

However, the Alt key works properly in all other (non-urwid)
programs I tested, and in 'emacs -nw' (which I think uses curses,
too).

When I ssh to the same SunOS/sparc machine from my Suse Linux/i386
machine, all works fine. When I boot OpenSolaris from
LiveCD on my i386 machine (the same one where the Alt key works
with Suse Linux) and run input_test.py, again the Alt key
won't work. :(


Here some output form my  Suse Linux/i386 machine:

xev: pressing Alt key:
keycode 64 (keysym 0xffe9, Alt_L)

xmodmap:
shift       Shift_L (0x32),  Shift_R (0x3e),  Caps_Lock (0x42)
lock
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_L (0x7d),  Meta_L (0x9c)
mod2        Num_Lock (0x4d)
mod3
mod4        Super_L (0x73),  Super_R (0x74),  Super_L (0x7f),
            Hyper_L (0x80)
mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x7c)


I even tried Linux on a ppc-machine, with an ordinary PC
keybord with Windows keys, but no working Alt-key with urwid...


Changing the value of TERM in bash doesn't seem to make any
difference. Normally I use TERM=xterm.


I really don't know what goes wrong, or if I overlooked something.
Excuse me for bothering if this is not an urwid problem.


Greetings,
Rebecca









More information about the Urwid mailing list