Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


Search this Thread
Old 02-11-2010, 11:49 PM   #1
LQ Newbie
Registered: Feb 2010
Posts: 2

Rep: Reputation: 0
Remapping shift&ctrl keys kills key repetition

I have a laptop where the enter and up arrow keys are physically broken. I have been able to solve this with the following commands:
xmodmap -e "remove shift = Shift_R"
xmodmap -e "keycode  62 = KP_Up KP_8 KP_Up KP_8 KP_Up KP_8"
xmodmap -e "remove control = Control_R"
xmodmap -e "keycode 105 = KP_Enter NoSymbol KP_Enter NoSymbol KP_Enter"
That code remaps RCtrl to enter and RShift to up arrow.
This code does work, but it has a minor flaw. When holding either of the keys, there are no repeated key presses. Is there any way to solve this through configuration alone? (Ie, not by modifying source code)

Related questions:
1) What is the best way to apply this configuration? Is there a configuration files for these mappings? (Right now I have a shell script that gets run on each X startup)
2) Any pointers as to how one can remap keys outside of X?
Old 02-12-2010, 12:45 AM   #2
LQ Newbie
Registered: Feb 2010
Posts: 2

Original Poster
Rep: Reputation: 0
I actually managed to solve it myself. The solution was to use xset r for the relevant keycodes. I should also point out the commands above contain an error. The "up" line actually makes shift up produce the character 8. (I guess I copied it from the numpad 8 key definition ) So my final script looks like this:
xmodmap -e "remove shift = Shift_R"
xmodmap -e "keycode  62 = KP_Up KP_Up KP_Up KP_Up KP_Up"
xmodmap -e "remove control = Control_R"
xmodmap -e "keycode 105 = KP_Enter NoSymbol KP_Enter NoSymbol KP_Enter"
xset r 62
xset r 105
Still looking for an answer to my additional questions.
Old 02-13-2010, 12:56 PM   #3
Senior Member
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 3,345

Rep: Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887
The alternative to an xmodmap script is more complicated and only worth doing for major alterations. You'd need to alter

For running without X, there doesn't seem to be an alternative to altering files. Look in
/lib/kbd/keymaps/i386/qwerty/ (or, or whatever)
and it's all there somewhere.


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
mouse keys as modifier keys (ctrl & alt) belda Linux - Desktop 3 06-25-2009 10:37 AM
Remapping keys using xmodmap - "home" key leeko Linux - Newbie 0 06-28-2008 01:31 PM
SHIFT-Backspace Kills X-Server larki Linux - Newbie 2 03-04-2006 11:28 AM
Key remapping erickFis Slackware 0 02-12-2004 05:00 AM
Remapping keys - is it possible? LooseCanon Linux - General 2 09-03-2003 10:36 PM

All times are GMT -5. The time now is 02:47 PM.

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 @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration