LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-17-2010, 04:58 PM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Rep: Reputation: 174Reputation: 174
Question How to change key mapping in Ubuntu 9.10


I have found that the <Enter> key on the numeric keypad does not act the same as the <Enter> key on the main keyboard. Confirming a file copy in Gnome Commander for example. Using xev I found the following
Quote:
Main <Enter>
------------
KeyPress event, serial 36, synthetic NO, window 0x5600002,
root 0x25d, subw 0x5600003, time 44244330, (50,55), root799,113),
state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
" XLookupString gives 1 bytes: (0d) "
" XmbLookupString gives 1 bytes: (0d) "
XFilterEvent returns: False

Keypad <Enter>
--------------
KeyPress event, serial 36, synthetic NO, window 0x5600002,
root 0x25d, subw 0x5600003, time 44245090, (50,55), root799,113),
state 0x10, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,
" XLookupString gives 1 bytes: (0d) "
" XmbLookupString gives 1 bytes: (0d) "
XFilterEvent returns: False
and using xmodmap -pke
Quote:
keycode 36 = Return NoSymbol Return NoSymbol Return
keycode 104 = KP_Enter NoSymbol KP_Enter NoSymbol KP_Enter
So based on some research it seems I should be able to edit my ~/.Xmodmap to assign the same key (Return) to keycode 104 - the keypad <Enter> key.

Except - I have no .Xmodmap. Am I supposed to? Did it move in Ubuntu 9.10? Do I have to create it? or does Ubuntu 9.10 use a "better" method of handling key mappings?

TIA,

Ken
 
Old 01-19-2010, 05:53 PM   #2
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
What's your problem? The keypad always gives KP_Enter instead of Return, but both eventually generate code 0A.
 
Old 01-19-2010, 08:06 PM   #3
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
Hi DavidMcCann,

The problem is that the keypad <Enter> does not activate the default button in dialogs. For example if I select a file in one Panel of Gnome Commander and press F5 to copy it to the location in the other panel a copy confirmation dialog comes up. The OK button is highlighted and is the default action. The main keyboard <Enter> will actuate the OK button. The keypad <Enter> will not.

Ken
 
Old 01-22-2010, 05:30 PM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
That's weird! It works fine with Fedora. What does xev return for the keys? Mind you, my xev is odd here: it identifies them as CR instead of LF.

You could try using xmodmap to reconfigure the key (see the man page).
 
Old 01-22-2010, 06:39 PM   #5
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
DavidMcCann,

The xev output is shown in the original post. I am not an expert in evaluating the data but is seems that the two keys are different. I will look into xmodmap.

Thanks,

Ken
 
Old 01-22-2010, 07:09 PM   #6
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
Many thanks DavidMcCann!!!

I delved into xmodmap and found a few things:

If Ubuntu has a .Xmodmap file it is well hidden - I had started down this road once before but could not find any such file ANYWHERE on the system.

So, as there is supposed to be one in $HOME/ and the format is supposed to match the output of xmodmap -pke I simply redirected the output of the command to create my own .Xmodmap.

I opened my new .Xmodmap file in gedit. Then I looked up the Enter key, keycode 36 and copied the data for that key "Return NoSymbol Return NoSymbol Return" and replaced the data for the keypad return key keycode 104 with the same string. I restarted the PC (guess I could have logged out and back in) anyhow the custom keymappings loaded. I confirmed them in xev and found that Gnome Commander now honors the keypad enter key

Now if only I could get the Gnome "file selector" dialog to respect my "single click performs the action" preference. However, that seems to be related to a bug (or philosophical disagreement) which dates back about 140 years

Regards,

Ken
 
Old 01-23-2010, 10:59 AM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
Quote:
Originally Posted by taylorkh View Post
Now if only I could get the Gnome "file selector" dialog to respect my "single click performs the action" preference. However, that seems to be related to a bug (or philosophical disagreement) which dates back about 140 years
If you mean in the Nautilus file browser, you can alter this with Edit Preferences - Behaviour. In general, you can have a "simulated secondary click", where a slow release counts as a double click: see System - Preferences - Hardware - Mouse - Accessibility.
 
Old 01-23-2010, 07:21 PM   #8
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
Hello again DavidMcCann,

The Nautilus file browser I have under control. Single click does the deed. Same for Gnome Commander. It is the dialog following Open; File (common to most applications) which does not work. I may try the mouse options although I will have to think what that might do in other situations. Which reminds me of a story...

I was working for a fortune 250 company converting data from a number of in-house applications to an off the shelf work management/supply chain suite of programs. We had a programmer on the team (a little weird - his belief was that if aquarium antibiotics worked for fish they would work for any other animal - even his family and himself) - anyhow the Lovebug worm was making its way around and this dude received a copy of it from some source. He saved it to his PC and right clicked on it with the intention of opening it in Notepad to have a look at the code. Anyhow he managed to trigger it. His PC was known to be a little flaky and often would seemingly substitute a double click for a single click on occasion or a double click for two single clicks a long time apart. Some weeks later, after Mr. Aquarium Antibiotics was fired for threatening another staff member, the PC presented a note on screen from Intel stating that the processor had exceeded its allowed error count and should be replaced under warranty. We did that and it never confused a click vs. a double click again.

Ken
 
Old 01-25-2010, 02:55 PM   #9
oshunluvr
LQ Newbie
 
Registered: Jan 2005
Location: long beach, ca
Distribution: Kubuntu "Jaunty" 9.04 x86_64
Posts: 19

Rep: Reputation: 2
My answer to this issue was to create my xmodmap file in /etc/X11/ because I wanted all users to have the edited keys then edit /etc/X11/Xsession and add this line...

Quote:
# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $

set -e

[ -f /etc/X11/Xmodmap ] && xmodmap /etc/X11/Xmodmap <----ADD THIS LINE HERE

PROGNAME=Xsession
If you wanted different xmodmaps for each user, change the file location to ~/Xmodmap or whatever you want
 
Old 01-25-2010, 03:02 PM   #10
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
That is a great idea oshunluvr. However, as the only users of this machine are me, myself and I... My home directory seemed to be the right place.

Ken
 
Old 01-25-2010, 03:06 PM   #11
oshunluvr
LQ Newbie
 
Registered: Jan 2005
Location: long beach, ca
Distribution: Kubuntu "Jaunty" 9.04 x86_64
Posts: 19

Rep: Reputation: 2
Then I suggest using ~/.xmodmap so the file is usually hidden from view.
Quote:
[ -f ~/.xmodmap ] && xmodmap ~/.xmodmap
The "-f" part in boxes checks to see if the file exists before loading so if you add another user, it won't try and load xmodmap

Last edited by oshunluvr; 01-25-2010 at 03:09 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mapping AltGr key to act as WIN key krisrao Linux - Newbie 3 02-11-2009 08:14 PM
Solved: Key mapping error in VMWare guest on Ubuntu 8.10 host taylorkh Ubuntu 0 12-15-2008 10:16 AM
Key Mapping SPK Linux - General 1 08-15-2006 11:27 AM
Problem with key mapping Honzik Linux - Hardware 2 05-08-2006 03:53 AM
mapping ^c to 'break' key MACSRULE Linux - General 0 01-02-2006 10:46 PM

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

All times are GMT -5. The time now is 07:09 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