LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-20-2006, 08:37 PM   #1
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
alt key not working in nano


I'm using IceWM on Debian Etch and trying to get nano to work, but it's not listening to me when I hit the alt key.

For example, to move the cursor down-by-paragraph, alt-0 inserts a funny "degree" symbol (like a super-scripted zero). But ESC 0 works just fine.

I've tried emacs, which uses the alt key extensively, and it works fine with emacs.

The nano help screen refers to the "meta" key, rather than the alt key.

How can I get the alt key to behave properly?
 
Old 02-21-2006, 09:15 AM   #2
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
Ok. Update: the left alt key works in the console. It's X (or IceWM) that's possibly intercepting that left alt key.

I've got a programmable keyboard, so I can remap the right alt key to give the same output as that left alt if need be.

Any other icewimmers out there see this problem?
 
Old 02-21-2006, 03:51 PM   #3
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
The problem is that the left alt key sends Alt_L to the X server while the right one sends Meta_R.
You should be able to solve the problem with
xmodmap -e "keysym Alt_L = Meta_L"
you can also add
keysym Alt_L = Meta_L
to ~/.xmodmap to make it persistent.

I may be completely backwards, I cannot check it at the moment. It may need to be
xmodmap -e "keysym Alt_L = Alt_L"

Last edited by dracae; 02-21-2006 at 03:53 PM.
 
Old 02-21-2006, 07:39 PM   #4
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
> The problem is that the left alt key sends Alt_L to the X
> server while the right one sends Meta_R.

Well, that may be the problem when using the console (what's
the "console" version of xev?), but from IceWM, both Alt keys
seem to work fine in everything except nano.

I posted this to the IceWM ML, but in case it's useful to
someone else here, the details on my system are:
Code:
$ xmodmap -pm
xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
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 (0x7f),  Hyper_L (0x80)
mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x7c)
xev tells me about my left and right:
Code:
KeyPress event, serial 30, synthetic NO, window 0x1000001,
    root 0x4c, subw 0x0, time 2364813, (424,-216), root:(430,615),
    state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x1000001,
    root 0x4c, subw 0x0, time 2364965, (424,-216), root:(430,615),
    state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 


KeyPress event, serial 30, synthetic NO, window 0x1000001,
    root 0x4c, subw 0x0, time 2365924, (424,-216), root:(430,615),
    state 0x0, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x1000001,
    root 0x4c, subw 0x0, time 2366068, (424,-216), root:(430,615),
    state 0x8, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes:
And the relevant parts of "xmodmap -pk" show:
Code:
    KeyCode     Keysym (Keysym) ...
    Value       Value   (Name)  ...

     64         0xffe9 (Alt_L)  0xffe7 (Meta_L)
    113         0xffea (Alt_R)  0xffe8 (Meta_R)
    115         0xffeb (Super_L)
    116         0xffec (Super_R)
    125         0x0000 (NoSymbol)       0xffe9 (Alt_L)
    127         0x0000 (NoSymbol)       0xffeb (Super_L)
    128         0x0000 (NoSymbol)       0xffed (Hyper_L)
    156         0x0000 (NoSymbol)       0xffe7 (Meta_L)
 
Old 02-21-2006, 07:46 PM   #5
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
See if there is a change with xmodmap -e "keysym Alt_L = Meta_L"

Edit: sorry misread the above.

Last edited by dracae; 02-21-2006 at 07:55 PM.
 
Old 02-21-2006, 07:46 PM   #6
kloss
Member
 
Registered: Nov 2004
Location: France & Germany
Distribution: (Pure) Debian Etch & Sid
Posts: 116

Rep: Reputation: 15
Quote:
Originally Posted by johnMG
what's the "console" version of xev?
You can give "showkey" a try...
 
Old 02-21-2006, 08:18 PM   #7
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
Ran:
Code:
$ xmodmap -e "keysym Alt_L = Meta_L"
as myself (not root).

Still the same problem with nano.

Now, the output which differs with what's posted above:

$ xmodmap -pm
Code:
mod1        Meta_L (0x40),  Meta_L (0x7d),  Meta_L (0x9c)
$ xev, hitting the left Alt key:
Code:
KeyPress event, serial 30, synthetic NO, window 0x1600001,
    root 0x4c, subw 0x0, time 4880742, (133,-51), root:(1549,940),
    state 0x0, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x1600001,
    root 0x4c, subw 0x0, time 4880886, (133,-51), root:(1549,940),
    state 0x8, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
    XLookupString gives 0 bytes:
$ xmodmap -pk
Code:
     64         0xffe7 (Meta_L)
    125         0xffe7 (Meta_L)
 
Old 02-21-2006, 08:25 PM   #8
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
> You can give "showkey" a try...

Thanks kloss. From a console, showkey tells me
Code:
left Alt:

    down   0x38
    up     0xb8


right Alt:

    down   0x64
    up     0xe4
 
Old 02-21-2006, 09:10 PM   #9
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
Try setmetamode esc or setmetamode meta. This is per tty, if it works you can add something like this to your rc.local, or equiv.(taken from manpage)

INITTY=/dev/tty[1-8]
for tty in $INITTY; do
setmetamode escprefix < $tty
done
 
Old 02-21-2006, 09:15 PM   #10
kloss
Member
 
Registered: Nov 2004
Location: France & Germany
Distribution: (Pure) Debian Etch & Sid
Posts: 116

Rep: Reputation: 15
Quote:
Originally Posted by dracae
See if there is a change with xmodmap -e "keysym Alt_L = Meta_L"
That may be dumb but why isn't it :
xmodmap -e "keysym Alt_L = Alt_R" ?
 
Old 02-21-2006, 09:33 PM   #11
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
Ok, got a little confused. First I thought the problem was in X, then the console, now X again. I am back on track, so disregard my previous post. What terminal emulator are you using? Do you have the same problem in others? xterm, Eterm, aterm, konsole, gnome-terminal?
 
Old 02-22-2006, 01:43 AM   #12
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by kloss
That may be dumb but why isn't it :
xmodmap -e "keysym Alt_L = Alt_R" ?
I think it's because X's rule is: "make whatever keycode that would usually result in a lhs_sym to instead generate a rhs_sym". So, dracae wanted me to tell X: "make whatever keycode that would usually generate an Alt_L instead generate a Meta_L" -- which would seem to make sense, since GNU nano is supposed to want a Meta when I hit my Alt key.

I'm trying to figure out what the issue is here, and in doing so am putting up a short help doc on the subject: http://www.simisen.com/jmg/keycode_keysym_keymap.html

Any input welcome, of course, especially since I've still got a couple of XXX's in that doc.

Thanks,
---J

Last edited by johnMG; 02-22-2006 at 01:59 AM.
 
Old 02-22-2006, 01:57 AM   #13
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
> Ok, got a little confused. First I thought the problem was in X,
> then the console, now X again.

I've got two separate problems:

1. In X, neither Alt key works with nano. They instead print funny little characters into my text file, and

2. In the console, only my left Alt key works in nano.

And now my third concern in understanding how all this works is, when I use "showkey", I seem to get a different keycode than I see with xev.

BTW, dracae, I've only ever used xterm. I just installed aterm, and [ ...drumroll...] nano works fine -- but this is with your xmodmap -e "keysym Alt_L = Meta_L" in effect.

I tried reversing that by running xmodmap -e "keysym Meta_L = Alt_L", and everything *still* works correctly in aterm. Weird. But nice. I wonder what the deal here is...(?)

Thanks.
---J

Last edited by johnMG; 02-22-2006 at 02:00 AM.
 
Old 02-22-2006, 08:53 AM   #14
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
OK, in xterm ctrl+left click. You should have 2 options, Alt sends escape and Meta sends escape. Try those to see if you get the desired effect.
 
Old 02-22-2006, 09:26 AM   #15
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
> OK, in xterm ctrl+left click. [snip]

dracae, I select the "Meta Sends Escape" item, and both Alt keys in nano now work!

Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ALT+B, ALT+F key combinations in xterm don't work nIMBVS cAos 5 05-06-2020 09:23 AM
Macomedia Flash - Alt key not working deVas Linux - Software 2 11-21-2005 02:05 PM
Alt key combinations not working in mc, Slackware 10.2 jcdrywater Slackware 3 11-21-2005 05:28 AM
How do I get Right-Alt key to be just Alt and not generate special characters? (KDE) KWTm Linux - General 2 06-25-2005 09:26 PM
Alt Gr key isn't working in Fluxbox jaakkop Linux - Software 0 04-03-2005 11:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 07:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration