"Shift (Left) + Shift (Right)" keyboard remapping is invalid
Microsoft PowerToys version
0.88.0
Installation method
GitHub
Running as admin
Yes
Area(s) with issue?
Keyboard Manager
Steps to reproduce
- Open Power Toys Settings, navigate to Keyboard Manager
- Select "Remap a Remap a shortcut"
- Add a shortcut remapping
- From the first dropdown under "Shortcut", select "Shift (Left)"
- From the second dropdown, select "Shift (Right)"
- Observe that there is an error that says "Shortcut cannot contain a repeated modifier"
✔️ Expected Behavior
- When selecting the left variant of a modifier key (ex: left shift) as input 1 and the right variant of that same modifier key (ex: right shift) as input 2 for the shortcut, there would not be a conflict, as both keys can be pressed independently and they function as two different keys on they keyboard, hence no key is actually being repeated here. This allows for creating a shortcut that requires both shift keys to be held at the same time.
- When selecting the left or right variation of a modifier key (ex: left shift) as input 1 and the generic (non-left/right) variant of that same modifier key (ex: shift) as input 2 for the shortcut, the error would display, as pressing the left shift key would also trigger the generic key press and the modifier is therefore repeated.
❌ Actual Behavior
- When selecting the left variant of a modifier key (ex: left shift) as input 1 and the right variant of that same modifier key (ex: right shift) as input 2 for the shortcut, an error pops up declaring that the shortcut "cannot contain a repeated modifier", even though the left shift key is a different key than the right shift key and has no reason to conflict. (Normal number keys and numpad keys function correctly and are allowed to be part of the same trigger, so having this restriction on the modifier keys like shift and ctrl specifically is unnecessarily limiting)
- The behavior for scenario 2 outlined under expected behavior performs exactly as expected.
Other Software
No response
@ZmaZes
This is not possible because of how Windows treats modifier keys. Windows cannot differentiate between the left and right shift keys for modifiers.
The RegisterHotKey documentation shows for fsModifiers that MOD_SHIFT does not differentiate between left and right shift. The same is true of accelerators.
Since both left and right shift are treated as the same modifier in Windows, and this keyboard mapping would be invalid.
Apologies if I'm misunderstanding, but I don't see how that can be true. Power Toys distinguishes between a shortcut like Shift (Left) + P and Shift (Right) + P just fine. Unless I'm missing something wouldn't that prove that something else is going on here?
@ZmaZes
Sorry, it appears you are correct here. I'll take a closer look into the shortcut handling and see what I can find.
It appears that PowerToys Keyboard Manager simply does not support the use of shift modifiers like this. Internally, each shortcut cannot have multiple shift keys assigned to it, it is for this reason that you cannot use both left and right shift in a shortcut.
@OldUser101 Sorry for missing the boat on this one a bit, I think your reply got lost in my email.
Keyboard Manager simply does not support the use of shift modifiers like this. Internally, each shortcut cannot have multiple shift keys assigned to it
Could it be supported then? And I guess will it be? I know of a command line tool that can achieve this remap but I was hoping to use Keyboard Manager and its easy to use UI and I'd rather not migrate all of my hot keys over if I don't have to.
@ZmaZes If it possible to do with other software, then it can most likely be implemented in Keyboard Manager.
I’m not sure if you can change the type of issue after you’ve made it, but if so, mark this issue as a feature request instead, if not, feel free to open a new one as a feature request.
Out of interest, which other tool is it that achieves this?
@OldUser101
mark this issue as a feature request instead
I don't think I am able, so I have opened a new issue here.
Out of interest, which other tool is it that achieves this?
I used kanata. It took me I think a good 2 hours to learn how to implement the double shift gesture with the tools available, and there is probably a better way to do it, but with the following code, both shift keys behave as normal individually, and when pressed simultaneously, the word "test" is typed.
(defsrc
lshift
rshift
)
(defalias both-shift
(multi (macro(t e s t)) (release-key lshift) (release-key rshift))
)
(deflayer main
(multi lshift (layer-while-held single-shift))
(multi rshift (layer-while-held single-shift))
)
(deflayer single-shift
@both-shift
@both-shift
)
Hopefully you can see why I'd love to have this implemented into Keyboard Manager instead of developing a small computer science degree to pull it off.