Fixing Ctrl+Backtick in VSCode
The other day, I ran into a problem while coding in VS Code. The default terminal shortcut Ctrl+` just wouldn't work on my new laptop. After digging around, I found out that some CJK IMEs hook this shortcut for their own use. The good news is that the key combination can still be captured by a global hotkey, so I put together a small tool that registers it and forwards the keypress to VS Code. And hopefully it worked.
Ideally, I would've built this as a VS Code extension, but I don't know much about front-end development. So instead, the tool runs in the background full-time, which comes with a couple of downsides:
- The key forwarding is done through a crude simulation, which can occasionally mess with other programs.
- The tool could be flagged as a cheat by anti-cheat software if users play games.
To minimize these issues, I added a simple window detection: the tool only kicks in when the active window's title ends with - Visual Studio Code.
Eventually, I decided to learn the ropes of VS Code extension development, and I managed to turn the tool into a proper extension. It works smoothly and avoids the side effects that came with the standalone version.
Turns out, the real culprit was a setting called "Switch to this IME" in the IME preferences, which grabs Ctrl+` by default. Disabling it fixed everything, making all my previous efforts completely unnecessary. What a plot twist...