User Tools

Site Tools


howto:moveshiftkey

How to move the right Shift key

If you're used to typing on a full-size keyboard, in many countries (at least, those using the qwerty layout) you'll find that the right Shift key is next to the / key. But on the Eee PC, the right Shift key is located one key further to the right. Because the Up key is located on the Eee PC where you'd expect to find the Shift key, you may find as you are typing that any time you go to capitalize a letter that you type with your left hand (e.g. an A), instead of capitalising the A, you instead move your cursor up a line and end up inserting an 'a' in the middle of some other word. Frustrating! You may decide you'd like your layout to be more like your full-size laptop. Here's how to do it.

  • Create directory called scripts (you could put it in /home/user for instance).
  • Now create an edit a file called setupkbd.sh: at a Terminal window (Ctrl-Alt-T in Easy Mode), type:

kwrite /home/user/setupkbd.sh

  • Current versions of Linux have slightly modified keymappings and should use this:
 #!/bin/sh
 # set up keyboard to exchange the Shift and Up keys, and the Down and Right keys
 xmodmap -e "keycode 62 = Up" # Shift => Up
 xmodmap -e "keycode 105 = Prior" # Shift-shift => PgUp ("Shift-shift" is the same as "Fn-Shift")
 xmodmap -e "keycode 111 = Shift_R" # Up => Shift
 xmodmap -e "keycode 112 = Control_R" # PgUp => Shift-shift ("Shift-shift" is the same as "Fn-Shift")(This key combination is equivalent to the Control key)
 xmodmap -e "keycode 116 = Right" # Down => Right
 xmodmap -e "keycode 117 = End" # PgDn => End
 xmodmap -e "keycode 114 = Down" # Right => Down
 xmodmap -e "keycode 115 = Next" # End => PgDn
 xmodmap -e "add shift = Shift_R" # Make the new Shift key actually do shifting
 xmodmap -e "remove shift = Up" # Prevent the old Shift key from shifting
 xset r 62 # Make the new Up key autorepeat
 xset r 105 # Make the new PgUp autorepeat
 xset -r 111 # Prevent the new Shift key from autorepeating
 xset -r 112 # Prevent the new Shift-shift (Fn-Shift) key from autorepeating
 #echo "All Done setting up keyboard."
  • Older versions of Linux should use this:
 #!/bin/sh
 # set up keyboard to exchange the Shift and Up keys, and the Down and Right keys
 xmodmap -e "keycode 62 = Up"        # Shift       => Up
 xmodmap -e "keycode 109 = Prior"    # Shift-shift => PgUp ("Shift-shift" is the same as "Fn-Shift")
 xmodmap -e "keycode 98 = Shift_R"   # Up          => Shift
 xmodmap -e "keycode 99 = Control_R" # PgUp        => Shift-shift ("Shift-shift" is the same as "Fn-Shift")(This key combination is equivalent to the Control key)
 xmodmap -e "keycode 104 = Right"    # Down        => Right
 xmodmap -e "keycode 105 = End"      # PgDn        => End
 xmodmap -e "keycode 102 = Down"     # Right       => Down
 xmodmap -e "keycode 103 = Next"     # End         => PgDn
 xmodmap -e "add shift = Shift_R"    # Make the new Shift key actually do shifting
 xmodmap -e "remove shift = Up"      # Prevent the old Shift key from shifting
 xset r 62                           # Make the new Up key autorepeat
 xset r 109                          # Make the new PgUp autorepeat
 xset -r 98                          # Prevent the new Shift key from autorepeating
 xset -r 99                          # Prevent the new Shift-shift (Fn-Shift) key from autorepeating
 echo "All Done setting up keyboard."
  • Now make the file executable by:

chmod 0755 setupkbd.sh

  • And test your script (You should see only the “All Done setting up keyboard.” message without any other error messages if successful):
 ./setupkbd.sh
  • Once your script is working, go back and comment out or delete the 'echo' line because we don't want it echoing away on startup.

What to do if the script doesn't work for all keys

If the script doesn't work for all of the keys, or you want to create a similar script for other keys, get a copy of xev if it is not already on your system: this is a graphical app that records all mouse and keyboard events. Start it from a Terminal window so you can see what it prints out, then move your mouse out of the way (it will generate many events if you move it). Now press a key. If you press the newly adjusted Shift key, you should see the following:

KeyPress event, serial 27, synthetic NO, window 0x20000001, root 0x69, subw 0x0, time 1692086123, (-8,26), root:(488,56), state 0x0, **keycode 98 (keysym 0xffe2, Shift_R)**, same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False The part in double asterisks is what we're after. You can see you generated a keycode 98 when you pressed that key, and it's current assigned to the Shift_R command (the default Eee PC had it assigned to the Up key).

Note: this wiki entry assumes that you have the qwerty layout and the US > Basic keyboard definition. Other arrangements will likely require modifications to the above script. If you have questions, post them to this forum

1000 Notes

On the 1000, it seems the right shift key is assigned only keycode 62. That is, Fnc-Shift still gives keycode 62; the shift key has no other keycode when used with the Fnc key. This may be because the 1000 has a Control_R key which assigned keycode 109. To modify the Shift key to be Up and also have Page Up, try these assignments for keys:

clear Shift
keycode 62 = Up Prior
keycode 102 = Down Next
add Shift = Shift_R
add Shift = Shift_L

In this way, Shift-Up and Shift-Down will produce PgUp and PgDn respectively.

Run your key-shift script automatically at start-up

To run your keyboard setup script automatically at startup, see this wiki entry.

Windows NT, 2000, XP, 2003, Vista

The free utility SharpKeys can be used to remap keys in versions of Windows from NT to Vista. It requires .NET Framework 2.0.

Move your keycaps to reflect the new layout

Once your script is working well and starting at startup, you may want to move the keycaps so they actually say what they do. To physically switch the keys, lift up very gently on the left side of the key with a paring knife or something similar until the key pops off of the scissors mechanism that holds them in place. Once the left side has popped off, gently slide the key to the left to completely dislodge it from the underlying mechanism. To reattach the keys, place them about 1mm to the right of the scissors mechanism. Then slide to the left, and press down until they snap into place. Warning: If you lift off the keycaps with too much force, or lift up on the wrong side, you could break the mechanism that holds them in place. Don't say I didn't warn you.

Your new key layout should look like this:

Surf 4G blk warning

On my unit surf 4g blk, my 'sissors mechanism' is on the right side. They came off using the left but it was a struggle..didn't break anything though. Be careful. PP

1000H warning

While detaching the key on my 1000H, I unhooked the scissors mechanism:

If this happens to you (and it happened on all the four keys for me), you will have to take out the mechanism and rehook it:

  • You will have to be patient and carefully when rehooking it.
  • You will have to look at an inserted mechanism to be able to put in place the repaired mechanism (so don't take them all out at once and don't put the keys on them before reinserting all the mechanisms)

Modifying the xfree layout

On my side, I found that when using the script at startup, each time you switch the keyboard layout, you need to run the script again. To fix that problem, I decide to modify the file /usr/share/X11/xkb/keycodes/xfree86 so the new layout is always available. Here is my diff output, hope this will help. ahudon

77c77
<     <RTSH> =  62;
---
>     <RTSH> =  98;
82c82
<     <RCTL> = 109;
---
>     <RCTL> =  99;
111c111
<     <PGUP> =  99;
---
>     <PGUP> = 109;
113,114c113,114
<     <END>  = 103;
<     <PGDN> = 105;
---
>     <END>  = 105;
>     <PGDN> = 103;
116c116
<     <UP>   =  98;
---
>     <UP>   =  62;
118,119c118,119
<     <DOWN> = 104;
<     <RGHT> = 102;
---
>     <DOWN> = 102;
>     <RGHT> = 104;
howto/moveshiftkey.txt · Last modified: 2012/11/17 12:00 by soniah