Disabling the Office Key


Did you know that some keyboards have a dedicated Office Key mapped to C-M-S-s? Really. It opens Office (either the app or the website) and there is no way to disable it. But I found a way. It is pretty retarded.

Let us for a minute ignore whether this is a misuse of market position by Microsoft (it is) or whether it is quite shitty that there is no way of turning it off (it is).

Only documentation I found comes from Microsoft's support forum (and stackoverflow). No, there is no nice switch in the settings. There is no prompt asking you if you even want this. However you can disable it by a registry hack. Sadly there are more shortcuts through which Microsoft tries to stuff their products down your throat, and they all share the C-M-S-s- prefix (so C-M-S-s-x for Excel, C-M-S-s-w for Word, ...) and the registry tweak disables just the main one (C-M-S-s).

So we could get rid of a way to open https://www.microsoft365.com (Who needs that?), but the reason I even started digging into this is the following line from my init.el:

(global-set-key (kbd "C-M-S-s-l") #'geiser-insert-lambda)

And Windows do provide C-M-S-s-l that opens https://linkedin.com/. Who needs that? No, really, who needs a keyboard shortcut to open fucking Linkedin?

(╯°Д°)╯︵ ┻━┻

No, I am not changing my keyboard layout just to get along with Windows. There has to be a way to solve this by hurting Windows in some way...

After searching a bit, I managed to find a solution from jorystewart. The overall idea is simple.

  1. Kill explorer.exe.

  2. Register all the hotkeys yourself.

  3. Start the explorer.exe and wait a bit to give it time to fail the hotkey registration.

  4. Un-register the hotkeys and shutdown.

That is it. It is really dumb, and it really works. It fits into 47 lines of commented C code.

I took the original code, rewrote it to pure C (why use C++ for this), polished it a bit and added a Makefile to install the executable into Startup directory. All the code can be found here.