Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 01-08-2004, 02:56 PM   #1
Registered: Jun 2003
Location: Istanbul - Turkey
Distribution: Fedora, Gentoo
Posts: 150

Rep: Reputation: 15
Remap windows keys


Like many, I am doomed to use a windows keyboard. The stupid manufacturer thought that everybody had to use windows and so afforded to put THREE extra buttons on it!
As you may know, this is terribly frustrating when using console applications such as emacs. I frequently have to press ctrl, and if I keep using this keyboard my little finger is gonna become taller then my middle finger. I have tried to look for another keyboard but all of them seems to be struck by this malformation.

Is there a way to "remap" (it is the first time i am using this word believe me) these buttons so they behave just like the usual ctrl and alt? I know I'll have two controls next to each other, but right now I am more concerned about my little finger.

I have no idea as to how this would be possible. Perhaps by recompiling the kernel?

Thanks for your insight,
Old 01-09-2004, 04:55 PM   #2
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Hi. Put the following commands somewhere where they'll be executed after X starts (a shell script in ~/.kde/Autostart for example):

xmodmap -e "keycode 115=Control_L"
xmodmap -e "keycode 117=Alt_R"

That should map key 115 (Windows key) to the left Control key, and 117 (Windows Right) to the right Alt key.

To be sure, fire up xev in a terminal while X is running. You'll get a window with a square in it. Any key you press will come up in the terminal like this:

KeyPress event, serial 25, synthetic NO, window 0x2a00001,
root 0x94, subw 0x0, time 97098412, (427,-177), root:(431,346),
state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes: ""

The keycode is the code of the key you pressed, and whatever shows where Control_L is is what X thinks the key means. Just hit the windows keys and replace what you get as the keycode in the commands above.

If you're not using X, then the following should do the trick

echo 'keycode ??? = Control' | loadkeys

Replace ??? with the keycode of the key you're remaping. I would check the man page for loadkeys for how to reset the keyboard before you start.


Last edited by ilikejam; 01-09-2004 at 04:57 PM.


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
remap keyboard windows key khtse Slackware 2 07-01-2004 01:14 PM
Desperately need to remap keys in Gnome basemodel Linux - Software 2 03-30-2004 11:50 AM
How do I remap keys? LooseCanon Linux - Newbie 1 08-27-2003 05:08 PM
using windows keys jayakrishnan Linux - General 1 10-09-2002 08:32 AM
how do i use the windows keys in linux. jayakrishnan Linux - General 2 09-21-2002 04:24 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:55 AM.

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