F12 key won't work when bound to "Show/hide terminal window" #18209

Closed
opened 2026-01-31 06:06:57 +00:00 by claunia · 5 comments
Owner

Originally created by @gapf2010 on GitHub (Aug 18, 2022).

Windows Terminal version

1.14.1963.0

Windows build number

10.0.22000.0

Other Software

No response

Steps to reproduce

Bind F12 key to "Show/Hide terminal window" action.
Save settings
Press F12 key, it will do nothing.

Expected Behavior

The binding is configured and pressing the F12 key shows or hides the terminal window.

Actual Behavior

It does allow the F12 key binding correctly, but pressing F12 does nothing. Binding other key (F10, for instance) does work as expected. Tested on Windows 11 and 10, both fully updated. Same terminal version on both Windows versions.

Originally created by @gapf2010 on GitHub (Aug 18, 2022). ### Windows Terminal version 1.14.1963.0 ### Windows build number 10.0.22000.0 ### Other Software _No response_ ### Steps to reproduce Bind F12 key to "Show/Hide terminal window" action. Save settings Press F12 key, it will do nothing. ### Expected Behavior The binding is configured and pressing the F12 key shows or hides the terminal window. ### Actual Behavior It does allow the F12 key binding correctly, but pressing F12 does nothing. Binding other key (F10, for instance) does work as expected. Tested on Windows 11 and 10, both fully updated. Same terminal version on both Windows versions.
claunia added the Needs-TriageIssue-BugNeeds-Tag-FixResolution-Won't-Fix labels 2026-01-31 06:06:58 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 18, 2022):

WEIRD, we've heard this exact issue before: https://github.com/microsoft/terminal/issues/13276#issuecomment-1154691397

Do you have a Lenovo PC/? I suspect it might have just pre-stolen the ability to bind that key.

@zadjii-msft commented on GitHub (Aug 18, 2022): WEIRD, we've heard this exact issue before: https://github.com/microsoft/terminal/issues/13276#issuecomment-1154691397 Do you have a Lenovo PC/? I suspect it might have just pre-stolen the ability to bind that key.
Author
Owner

@gapf2010 commented on GitHub (Aug 19, 2022):

WEIRD, we've heard this exact issue before: #13276 (comment)

Do you have a Lenovo PC/? I suspect it might have just pre-stolen the ability to bind that key.

Hi, in fact yes, one of the machines where I tested is a Lenovo laptop (same one I used for the post you linked, which was made by me also) however this F12 key also fails to work on a desktop machine based on an ASUS motherboard, so this is not Lenovo specific. It also fails to work on another laptop and even on a virtual machine, so that'd be 4 different machines where it fails.

@gapf2010 commented on GitHub (Aug 19, 2022): > WEIRD, we've heard this exact issue before: [#13276 (comment)](https://github.com/microsoft/terminal/issues/13276#issuecomment-1154691397) > > Do you have a Lenovo PC/? I suspect it might have just pre-stolen the ability to bind that key. Hi, in fact yes, one of the machines where I tested is a Lenovo laptop (same one I used for the post you linked, which was made by me also) however this F12 key also fails to work on a desktop machine based on an ASUS motherboard, so this is not Lenovo specific. It also fails to work on another laptop and even on a virtual machine, so that'd be 4 different machines where it fails.
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2022):

Hey wait I found it!

From the RegisterHotKey docs:

The F12 key is reserved for use by the debugger at all times, so it should not be registered as a hot key. Even when you are not debugging an application, F12 is reserved in case a kernel-mode debugger or a just-in-time debugger is resident.

I'm pretty tempted to just add docs that'll say as much - I don't think it's in our best interest to steal F12 away from debuggers.

@zadjii-msft commented on GitHub (Aug 22, 2022): Hey wait I found it! From the [`RegisterHotKey`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey) docs: > The F12 key is reserved for use by the debugger at all times, so it should not be registered as a hot key. Even when you are not debugging an application, F12 is reserved in case a kernel-mode debugger or a just-in-time debugger is resident. I'm pretty tempted to just add docs that'll say as much - I don't think it's in our best interest to steal F12 away from debuggers.
Author
Owner

@gapf2010 commented on GitHub (Aug 22, 2022):

Wait...why does a regular user need a dedicated debugger key on their Windows PC? I think there should at least be an option to disable that and use F12 like a regular key.

@gapf2010 commented on GitHub (Aug 22, 2022): Wait...why does a regular user need a dedicated debugger key on their Windows PC? I think there should at least be an option to disable that and use F12 like a regular key.
Author
Owner

@zadjii-msft commented on GitHub (Aug 22, 2022):

We had a quick chat about this - the only way for us to try and get around this is by installing a low-level keyboard hook, and filtering out just F12 keypresses. We've had a sibling team implement this in the past for their app, and it's caused no end of trouble. I think it's best that we just clearly document that F12 won't work as a globalSummon keybinding in the Terminal, than try to write a big-ol' workaround for a single key.

I honestly don't know how the OS uses the F12 <-> debugger keybinding, but probably best we not get in the way of something like that.

@zadjii-msft commented on GitHub (Aug 22, 2022): We had a quick chat about this - the only way for us to try and get around this is by installing a low-level keyboard hook, and filtering out just F12 keypresses. We've had a sibling team implement this in the past for their app, and it's caused no end of trouble. I think it's best that we just clearly document that F12 won't work as a `globalSummon` keybinding in the Terminal, than try to write a big-ol' workaround for a single key. I honestly don't know how the OS uses the F12 <-> debugger keybinding, but probably best we not get in the way of something like that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18209