Global Hot Keys in ConEmu
ConEmu ‘Keys & Macro’ page contains few hotkeys marked as ‘Global’. Thought, most using are ‘Minimize/Restore’ and ‘Activate ConEmu and ‘CD’ to last Explorer window path’.
These hotkeys are registered globally in system via RegisterHotKey and are available even ConEmu has no focus.
That is because these hotkeys are processed by Windows. However, some limitations applied:
- Hotkeys depend on active keyboard layout. The solution is below.
- You can’t use Apps as modifier.
- Left and Right modifiers are indifferent.
- You can’t register hotkey already registered by any other application. Actually, a lot of hotkeys are seized by Windows itself.
- 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. The solution is below.
Active keyboard layout dependency (Quake hotkey)
Perpaps, this is most frustrating limitations. Global hotkeys are processed by Windows kernel, and application receives only WM_HOTKEY message. But the function RegisterHotKey gets as parameter Virtual Key Code, which depends on user’s active keyboard layout.
So, there is no way to register global hotkey by ‘hardware scan code’ which is layout independent. Well, unless hooking absolutely all running applications, which is not a good option…
There are two solutions.
- If the ‘Minimize/Restore’ (also known as ‘Quake style slide down/up’) hotkey is not working on your secondary keyboard layout (language), you may set up additional hotkey for that layout: ‘Minimize/Restore (alternative)’. So, you will get two global hotkeys, one per keyboard layout.
- AutoHotKey allows to set up almost unlimited amount of global hotkeys and actions. Refer to their documentation and ConEmu’s automation language GuiMacro.
Using F12 as global hotkey
MSDN claims, that F12 is reserved for use by the debugger.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug] "UserDebuggerHotKey"=dword:00000000 ; The default, steal F12 global hotkey
describes a way how to choose another key via registry.
For example, change the value to
0x13 to use
Pause key for debugger.
NB That disallows using
Pause as global hotkey,
but you still may use it (and combinations) as local hotkeys.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug] "UserDebuggerHotKey"=dword:00000013 ; Change it to Pause global hotkey