Last active
July 9, 2020 14:47
-
-
Save atsuoishimoto/f5268c247fa1a48ff523088a395cf25e to your computer and use it in GitHub Desktop.
Map capslock to control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import winreg | |
key = 'System\\CurrentControlSet\\Control\\Keyboard Layout' | |
scancodemap = (b'\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00' | |
b'\x00\x00\x1d\x00:\x00\x00\x00\x00\x00') | |
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key, access=winreg.KEY_WRITE) as h: | |
winreg.SetValueEx(h, 'Scancode Map', 0, winreg.REG_BINARY, scancodemap) | |
print('Registry updated. Reboot now.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment