Thursday, April 26, 2018

windows 10 - Make a shift key behave like an arrow key


I have a Windows 10 laptop with a keyboard designed by idiots. They tried to cram the arrow keys where they don't belong, with the result that the up arrow key is between the right shift key and the / key (US keyboard layout). This is one of the stupidest things the designers could have done, because it means that when I go to hit the right shift key (which is most of the time), I end up hitting up arrow instead. This is incredibly annoying.


I found a program called Sharp Keys which allows me to remap the keys such that the up arrow behaves as shift and the right shift behaves as up arrow. Now, at least I can type. However, I've now lost important functionality for the up arrow key. Up arrow (now labeled "shift" on my keyboard) doesn't repeat. So, I can't just hold the key down to move up. Instead, I have to hit the key repeatedly. How can I fix this, so my right shift key behaves like up arrow and my up arrow key behaves like right shift?


Following a suggestion from the comments, I installed AutoHotkey. I have the following script:


RShift::Up
Up::RShift

I have the same problem as earlier. But, since AHK is a scripting language, is it possible to use it to change the repeat behavior?


Answer



While JJohnston2's answer gave me part of the solution, I wound up asking several other places and doing a lot of experimentation myself. Here's what I eventually wound up with:


Up::RShift
*RShift::
delay=400
While GetKeyState("RShift", "P") {
Send {Blind}{Up}
Sleep %delay% ; Set delay to taste
delay=30
}
Return

This solves the problems of key repeat and allowing shift+up to work as expected. There are two outstanding issues that I haven't solved, but which are low enough in priority that I'm going to consider this question solved anyway:



  1. The race condition isn't solved. I tried to put the first iteration outside of the loop, as JJohnston2 did, but it had no observable effect for me.

  2. The root cause of all this trouble is that the system doesn't seem to repeat the shift, Ctrl, or Alt keys, even though the others repeat. So, AHK can't repeat what it never sees. Since everyone I've asked for help hasn't had this issue, there must be something funky with my setup, but I don't have the foggiest idea what that might be.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...