Search code examples
windowswinapikeyboardpower-toys

How to send "Ctrl+Keys" using Win32API's SendKeys function while CapLock and Ctrl are swapped in PowerToys?


I use PowerToys to remap Left Ctrl to CapLock and remap CapLock to Left Ctrl. Yet, I am using a Sublime Text plugin which uses python's win32com.client.Dispatch("WScript.Shell").SendKeys function to send keybindings such as "Ctrl+A" ("^a") and "Ctrl+V" ("^v").

However, since Left Ctrl and CapLock are swapped using PowerToys, I find that every time SendKeys("^a") is executed, CapLock is pressed first, followed by "a", so it prints "A".

Is there a way to work around this, e.g. letting SendKeys ignore PowerToy's key remapping? Thanks!


Solution

  • Sorry that I found a solution seconds after posting this... Remapping Right Ctrl to CapLock solves the problem.enter image description here