The Office Key is a new key that you’ll find on Microsoft keyboards. It lets you quickly launch apps like Word, but you can remap it with AutoHotkey to act as an extra modifier key or disable the app shortcuts altogether.
What Is The Office Key?
You’ll find this key on new Microsoft keyboards released after October 15th. You may have also heard of the dedicated emoji key Microsoft added along with it; both keys slot in where the right Windows key and menu key used to be, in between Right Alt and Right Control:Out of the box, the Office key opens up the Office application and has several hotkeys to open up specific Microsoft apps. There are basic hotkeys like Office+W and Office+X to open Word and Excel, but also some more obscure ones—Office+L, Office+T, and Office+Y open up LinkedIn, Microsoft Teams, and Yammer.
The Office Key Sends Shift+Control+Alt+Windows
This is convenient, but you might think that this is a new key Microsoft created, similar to the Windows key. But Microsoft cares about backward compatibility, and inventing a whole new key would be a hassle, so it took a shortcut.You may have heard of the “hyper” key. Hyper was an old modifier key from way back when and was used on the Space-cadet keyboard for Lisp machines. It’s practically a fossil. You won’t find it on any modern keyboard, and it isn’t supported in any current OS. But the name is cool, and it stuck around as a term for an obscure modifier key that isn’t used by any applications.
Nowadays, the Hyper key is emulated with a combination of every modifier key. On macOS, this maps to Shift+Control+Option+Command. On Windows, the Hyper key is emulated with Shift+Control+Alt+Windows.
The thought behind this mapping is that no UX designer is going to be crazy enough to design an application that requires a user to press all four modifier keys at once. This essentially gives you an entire keyboard worth of modifier keys for you to bind however you’d like, which is great.
Or, at least, it was—in Windows 10’s May 2019 update, Microsoft added preliminary OS support for the Office key before it was released to the public. Guess what the Office key maps to?
It’s Hyper. Rather than implementing a new key, the Office key acts as all four modifier keys. The emoji key isn’t really a key itself; it maps to the shortcut Office+Space, which you can press yourself to open the emoji viewer. (You can press Windows+. or Windows+; to open the emoji panel, too.)
Having a dedicated Hyper key on your keyboard would be great. Most people repurpose Caps Lock, but the Office key would replace the useless Right Windows key and turn it into something useful. Unfortunately, out of the 27 available letter keys and spacebar, 10 of them are in use by the Office key shortcuts, with the possibility of Microsoft adding more in the future. Currently, there’s no built-in way to turn off these shortcuts. There’s no option in Settings, no registry tweak, and no group policy.
Naturally, the fact that you can no longer press Hyper+Y without being taken to the marketing page for Yammer has made Hyper key users fairly upset. There are, however, a few tweaks you can do yourself to either remap the key or turn the shortcut off altogether. Before we get started with AutoHotkey, there is one registry tweak you’ll need to enable by running the following command in PowerShell. Right-click your Start button and click “PowerShell” to open it:
REG ADD HKCU\Software\Classes\ms-officeapp\Shell\Open\Command /t REG_SZ /d rundll32Usually, when you press the Office key on its own, it opens up the Office app. This modifies the location that gets opened, preventing the app from starting whenever the key is pressed. Unfortunately, there’s nothing similar we’ve found in the registry that would allow the app-specific hotkeys to be disabled, so you’ll need to remap those manually. If you find a way to disable the app-specific shortcuts from the registry, let us know in the comments, and we’ll update this article.
How to Remap the Office Key With AutoHotKey
AutoHotkey is a program for remapping keyboard keys to specific actions. It can do a lot more, but in this case, we really only want to use it to remove the Windows key from the Office key combinations.AutoHotkey installs a low-level keyboard hook that intercepts keyboard events before the rest of the system gets to them. If it matches a configured hotkey, the event is intercepted by AutoHotkey. AutoHotkey can then send its own modified keyboard events. This doesn’t allow you to send the
Shift+Control+Alt+Win+W
hotkey, however, as that will still trigger the Word shortcut. You can, however, send Shift+Control+Alt+W
.
That’s still unwieldy enough to be considered a Hyper key you wouldn’t
normally press, although you’ll have to double-check to make sure your
applications aren’t using it.The following script will remap Office+W to
Shift+Control+Alt+W
. Just save the text as an AutoHotKey script and run it:#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #UseHook #InstallKeybdHook #SingleInstance force SendMode Input #^!+W:: Send ^!+W returnThe character sequence “
#^!+
” is AutoHotkey shorthand
for Windows, Control, Alt, and Shift, respectively. This script matches
Office+W and sends back the corrected sequence, which solves the issue
of Word opening.Of course, you’ll also need to remap the other keys, T, Y, O, P, D, L, X, N, and Space, so the full script is much longer:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #UseHook #InstallKeybdHook #SingleInstance force SendMode Input #^!+W:: Send ^!+W return #^!+T:: Send ^!+T return #^!+Y:: Send ^!+Y return #^!+O:: Send ^!+O return #^!+P:: Send ^!+P return #^!+D:: Send ^!+D return #^!+L:: Send ^!+L return #^!+X:: Send ^!+X return #^!+N:: Send ^!+N return #^!+Space:: Send ^!+Space returnYou can use the corrected hotkeys for each of the ten keys the Office key uses, but you’ll be able to use the full Hyper key for each key that isn’t used. You can also map these hotkeys to AHK functions, so you have total freedom over them, provided you handle them in some way so that the Office app doesn’t open.
This solution is probably good enough for most people until Microsoft decides to allow this to be turned off (if ever). But, if you really want to disable the Office app shortcuts altogether, there is a hacky solution.
How to Remove Office Key Integrations Entirely
Warning: The following is a bit of an ugly hack. This solution is really only for advanced users, so if you don’t know what you’re doing, stick to the AutoHotkey solution.But, if you want to use the Shift-Control-Alt-Win key combination as a Hyper key and wish Microsoft never added the Office hotkeys in the first place, there is a solution that solves the problem entirely.
In Windows, system-wide hotkeys must be registered with the operating system using the RegisterHotKey system function. Under the hood, the Office Key hotkeys are registered this way by Explorer, the process that’s responsible for your desktop, taskbar, and File Explorer. It’s an integral part of Windows, so it makes sense to register hotkeys here; hotkeys created with RegisterHotKey will automatically deregister when the process that registered them closes. Since Explorer is always open, the hotkeys will be permanent.
Our first thought is to override the Office hotkeys by registering our own. But, if you create a program that runs RegisterHotKey, you’ll find that it won’t work. You can’t register hotkeys that have already been registered by another program.
However, when programs exit, they automatically deregister their hotkeys. This means if you can close the program that registered the hotkeys, you can disable them. Unfortunately, closing Explorer isn’t a very viable solution, as you’d be stuck without a usable computer. And if you restarted Explorer, it would reregister the hotkeys when it starts back up.
So this solution works like this: The Office-key fixing program closes Explorer, which frees up the hotkeys to be overwritten. It then registers each Office-key related hotkey we want to disable and restarts Explorer. When Explorer starts back up, it tries to register the Office key hotkeys like normal but is blocked because our program already registered them. It only tries to do this on startup, so all we have to do is wait a few seconds and then exit the program. This deregisters the hotkeys in the process, which allows them to be used by other programs.
This solution works perfectly, and allows the actual Office key or emulated Hyper key to use every shortcut on the keyboard with no risk of opening random Microsoft apps. It cuts off the Office key hotkeys entirely. Explorer doesn’t even get sent a message when you press these key combinations.
The only downside is that because we’re restarting explorer, when this program runs on startup, it will flash the desktop black for a split second before restarting. It’s not super intrusive, but it’s enough to notice. If your PC takes a second to load the startup apps, it will close any File Explorer windows you have open. The upside is that you can rest easy knowing that you’re 1-0 in the fight against Microsoft’s marketing department for control of your keyboard.
Anyway, the script is a relatively short bit of C++:
#include <windows.h> #include <stdio.h> #include <thread> #include <chrono> #include <iostream> int main(int argc, wchar_t* argv[]) { //Build Array Of Keys To Unregister //These map to W, T, Y, O, P, D, L, X, N, and Space, respectively. UINT offendingKeys[10] = { 0x57, 0x54, 0x59, 0x4F, 0x50, 0x44, 0x4C, 0x58, 0x4E, 0x20 }; //Kill Explorer system("taskkill /IM explorer.exe /F"); //Register hotkey for (int i = 0; i < 10; i++) { RegisterHotKey(NULL, i, 0x1 + 0x2 + 0x4 + 0x8 | MOD_NOREPEAT, offendingKeys[i]); } //Restart Explorer system("start C:/Windows/explorer.exe"); /* Sleep for a few seconds to make sure Explorer has time to attempt to register the Office hotkeys, and get blocked by our hotkeys */ std::this_thread::sleep_for(std::chrono::milliseconds(4000)); //deregister hotkeys by ID for (int i = 0; i < 10; i++) { UnregisterHotKey(NULL, i); } return 1; }You can also find it here on GitHub. You’ll have to compile it yourself, but you shouldn’t really be running random executables you find on the internet, anyway. Once you have it as a binary, place it in
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
so it will run after your computer boots.Executables placed in the startup folder take a bit to open, so the program will probably run 5-10 seconds after you see the desktop. It will close out any File Explorer windows you have open, but won’t close down other applications like Chrome.
If anyone reading this knows of a way to prevent Explorer from registering the hotkeys without restarting it—or if it’s somehow possible to deregister hotkeys created by another thread—feel free to let us know in the comments.
Post a Comment