Remapping F12

Is there a way to remap F12 key on Windows 11 without powerkey or any other app?

bumping this old topic.
I would like to remapp F12 too. Pop!_OS currently set it to either totem or firefox… which I want to change to “setting”

I Have the exact same problems. Would love to remap it to go to sleep, since my power button is hibernate. Shouldn’t be too difficult I thought. I tried to make a script run (From registry) but that didn’t work. Remapping via VIA also doesn’t work for some reason. I map it to Sleep, then it does nothing…

I have it mapped to the calculator, but I use two different Power Toys to make it work.

Finally got it to ‘work’.
Installed Autohotkey and made a Win+x - U - S script to enter sleep mode
Went to the registry and selected that .exe autohotkey script to execute when pressing the button. Now the laptop goes to sleep. I’d rather see Framework give the option to change it (since selecting ‘sleep’ in VIA settings does nothing).

You can actually remap the F12 key without PowerToys, just with a registry entry. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\16 and create a string key named “ShellExecute”. I have mine set to “C:\Windows\System32\calc.exe” to open the calculator.

Sadly there isn’t an easy way to map ‘sleep’ to this button. There is no sleep.exe or something similar.

Try this: Is there a command line tool to put Windows 8 to sleep? - Super User

Not sure if you can do arguments directly in the ShellExecute value. if not, put it all in a batch script and call that.

Edit: just to make sure this is not an XY problem: is there a reason why you don’t configure the power button to send the laptop to sleep?

I mapped the power button to hibernate.

But hey, I got it to work so that’s nice.

The link you attached didn’t work in the couple minutes I spent to get it to work.

The symbol XF86AudioMedia is assigned for the F12 media key in Linux.

https://wiki.archlinux.org/title/Framework_Laptop_13#Function_keys

I am assigning the firefox <specific url> for the F12 media key on my window manager Sway in Linux. Below is my Sway config file. Though I am not sure which window manager you are using.

2 Likes