LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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-11-2010, 11:49 PM   #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, 12: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, 12:56 PM   #3
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

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