How to remap keys with modifiers on Windows 10

1

I've been searching around and can't seem to find the answer I'm looking for. I'm using a Swedish keyboard layout and everything is where I want it to be except the curly brackets. Currently I press Ctrl+Alt+ 7/0 to insert curly brackets { } respectively. This is a real hassle as those brackets are coming to use more and more often.

I would like to rebind those keys, preferably to Alt or Ctrl scroll up/down. Is this at all possible, and if so, how? I'm using CLion if that's to any help.

Trollblod

Posted 2019-11-04T15:51:48.527

Reputation: 27

Answers

0

The free key-remapping product AutoHotkey can remap these keys for the entire Windows.

The following AutoHotkey script will remap:

Ctrl+Alt+PgUp => Ctrl+Alt+7
Ctrl+Alt+PgDn => Ctrl+Alt+0

^!PgUp::Send, {Ctrl down}{Alt down}7{Alt up}{Ctrl up}
^!PgDn::Send, {Ctrl down}{Alt down}0{Alt up}{Ctrl up}

These keys don't do anything on my keyboard, so my testing was pretty limited.

After installing AutoHotKey, put the above text in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group at C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.

harrymc

Posted 2019-11-04T15:51:48.527

Reputation: 306 093

Alright this looks awesome, I just gotta remember to close it after closing CLion, should be able to make a python script launching AHK + starting CLion, however it would be beneficial if AHK turned off when CLion turned off. This is due to some games recognizing AHK as "cheats" even though they are being used as something else. – Trollblod – 2019-11-04T19:43:30.587

If I were to remove the ctrl component from here, what would I do? I just want to hold down alt to insert those brackets. I also changed PgUp/Down to WheelDown/Up, and it works as long as I keep the ctrl component in the script. But it would be nice if I only had to hold down one of the keys (Alt or control). – Trollblod – 2019-11-04T19:53:15.123

^ is for Control, ! for Alt. So just take out the ^ character. See link. – harrymc – 2019-11-04T21:16:39.293