LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-09-2010, 11:44 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
Changing the keyboard keys (that is, remapping them).


Hi:
I want the system to see a certain keyboard key as if it were another key. To put an example, suppose I want each time I type 'e' the system sees 't'. Can this be done? Any suggestion would be greatly appreciated. Thanks for reading.
 
Old 06-10-2010, 03:55 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Take a look at:

/usr/share/kbd/keymaps/i386/dvorak/dvorak.map.gz
/usr/doc/kbd-1.15/dvorak/dvorak.xmodmap

for some hints on how to remap keys, you'll probably have to make your own map file, and have the system use it. Not sure why you would want to do this, but you can. Also note that the console and Xorg can use different keymaps, so you have to change both.

Oh and the 'xev' command will come in handy for getting the key codes.

Last edited by H_TeXMeX_H; 06-10-2010 at 03:57 AM.
 
Old 06-10-2010, 12:03 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by H_TeXMeX_H View Post
Not sure why you would want to do this, but you can.
The reason is mine is a non-US keyboard and I find it awkward (uncomfortable). Specially because it has two additional keys between Alt and Ctrl (on the right), one of them with the logo of windows and the other with some kind of icon on it. Likewise on the left. I use Ctrl+Z a lot and always miss the control key. Plus, most of the special symbols have been relocated. And all this because we have an additional letter between n and o in our alphabet! They have left the old keyboard absolutely unrecognizable, with keys such as left shift and backspace half their original sizes.

Well, excuse me for this anger, but I had to tell somebody. Thanks for your reply. I have found all the files you have mentioned and will study the docs.

Enrique.
 
Old 06-10-2010, 12:07 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by stf92 View Post
The reason is mine is a non-US keyboard and I find it awkward (uncomfortable). Specially because it has two additional keys between Alt and Ctrl (on the right), one of them with the logo of windows and the other with some kind of icon on it.
The "Windows Logo" key is actually the Super key. It existed before M$ and for some reason M$ decided to put their logo on it. It's actually quite useful. You can use it, for example, to launch applications of do special window manager actions.

And that other one is the menu key. It opens up the context menu for whatever is selected.
 
Old 06-10-2010, 12:33 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
xmodmap is the way to go. For example, I hate the "Caps lock" key, and prefer it just to work as "Shift"
So I run this at login:
Code:
xmodmap -e "remove Lock = Caps_Lock"
xmodmap -e "add Shift = Caps_Lock"
see man xmodmap and there are plenty of HOWTOs on the web

Last edited by tredegar; 06-10-2010 at 12:34 PM.
 
1 members found this post helpful.
Old 06-10-2010, 12:41 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Yes. But what about when not having run X yet. I only start X in rare times. For example to enter LQ, Google or Wikipedia.
 
Old 06-10-2010, 12:55 PM   #7
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Outside of Xorg, you just have to make a keymap file I think, so in '/usr/share/kbd/keymaps/i386/'. Then you can use 'loadkeys' to load it.
 
1 members found this post helpful.
Old 06-10-2010, 01:02 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by H_TeXMeX_H View Post
Outside of Xorg, you just have to make a keymap file I think, so in '/usr/share/kbd/keymaps/i386/'. Then you can use 'loadkeys' to load it.
Thank you, H_TexMex_H. I have found a great deal of doc in my system. I'll study it. Regards.
 
  


Reply

Tags
keyboard



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remapping shift&ctrl keys kills key repetition nitro2k01 Linux - Desktop 2 02-13-2010 12:56 PM
keyboard remapping? FirebirdV0273 Linux - Hardware 2 05-20-2006 10:27 AM
keyboard remapping bicolano53 Linux - Newbie 1 09-21-2004 09:03 PM
changing keyboard keys functions grizzly Slackware 2 01-10-2004 09:05 PM
Remapping keys - is it possible? LooseCanon Linux - General 2 09-03-2003 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:18 PM.

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