LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 02-12-2010, 12:49 AM   #1
nitro2k01
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:
Code:
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, 01:45 AM   #2
nitro2k01
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:
Code:
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, 01:56 PM   #3
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 3,216

Rep: Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820
The alternative to an xmodmap script is more complicated and only worth doing for major alterations. You'd need to alter
/usr/share/X11/xkb/symbols/pc
/usr/share/X11/xkb/symbols/keypad

For running without X, there doesn't seem to be an alternative to altering files. Look in
/lib/kbd/keymaps/i386/include/linux-keys-bare.inc
/lib/kbd/keymaps/i386/qwerty/uk.map.gz (or ..us..., or whatever)
and it's all there somewhere.
 
  


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


All times are GMT -5. The time now is 07:36 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration