PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Control remap does not interact well with Visual Studio keyboard shortcuts

Open rnikander opened this issue 1 year ago • 3 comments

Microsoft PowerToys version

0.76.2

Installation method

Microsoft Store

Running as admin

None

Area(s) with issue?

Keyboard Manager

Steps to reproduce

I used PowerToys to switch Caps Lock and Left Ctrl. In most places, it works -- for example, I can usually hit "Caps Lock + C" and it will remap as expected to "Ctrl + C" and run a copy.

In Visual Studio there is a shortcut for the command Edit.ParameterInfo. You can find it by going to menu: Tools > Options. Then Environment > Keyboard, and typing the command name or some part of it in the field "Show commands containing:". It shows that the shortcut is "Ctrl+Shift+Space (Text Editor)". When I go back to my code editor, and put the cursor somewhere this should work, after parentheses, for example foo(|), the key command does not work when I hit the keys "Caps Lock + Shift + Space". If I use the right Ctrl key, which has not been remapped, and combine it with Shift+Space, then the command is activated and the parameter info is shown.

Here's a screenshot showing the command when it is properly activated.

image

Here's a screenshot of my key mapping in PowerToys:

image

✔️ Expected Behavior

The Caps Lock key should behave like it's a Ctrl key, reliably. So hitting the physical keys "Caps Lock + Shift + Space" should be like I hit "Ctrl + Shift + Space" and it should run the Visual Studio command.

❌ Actual Behavior

It doesn't trigger the command.

Other Software

Visual Studio 17.8.3

rnikander avatar Dec 21 '23 00:12 rnikander

Actually, as I play with this more it seems that...

  1. Shortcuts like Ctrl+Shift+A work fine. It's only this combo with the Space that's weird.
  2. Other Caps-Ctrl re-mappers have the same issue. The old registry edit hack that you see around, and even this driver-level thing: https://learn.microsoft.com/en-us/sysinternals/downloads/ctrl2cap. I get the same behavior in Visual Studio.

So, maybe this is more a Visual Studio issue?

rnikander avatar Dec 21 '23 01:12 rnikander

I think it's a Visual Studio issue, as I am having the same issue. ctrl (remapped )+ click works fine for example to open a link a new tab in the browser, but on Visual Studio, it won't bring me to the definition, and it does when it's not remapped. Looks like someone raised a similar issue (which got closed) for VSCode: https://github.com/microsoft/vscode/issues/162629

NicolasRoelandt avatar Apr 12 '24 17:04 NicolasRoelandt

If you run VS as Admin, you need to run PowerToys as admin as well https://powertoys.io/keyboard-manager-utility-for-windows/ https://stackoverflow.com/questions/67593307/microsoft-powertoys-key-mapping-not-working-in-visual-studio

xpengineer avatar May 13 '24 22:05 xpengineer