New Model F (F77) QMK/VIA question on grave escape override

User avatar

06 Apr 2021, 09:04

Just received my new model F - after a bit of fuss installing the keys a few times to get them adjusted correctly, it's absolutely amazing.

Next problem was to remap the keys. Much appreciation to this thread (viewtopic.php?f=50&p=482419) which laid out the steps to set up QMK and VIA and get a working board simply and quickly.

As a mac user and frequent vi user, my next step was to get the escape/tilde/backtick behavior sorted. I found this documentation ( ... _grave_esc) with a sensible start that basically maps esc -> esc, but shift+esc to tilde. I was able to find in VIA in the keymap the "` esc" key that corresponds to KC_GESC.

Note that I have left my modifier keys in windows default order (lctrl, lwin, lalt, space, ralt, rwin, ralt) and used the macos keyboard preferences to swap option/command.

In this configuration:
- escape alone works as escape [good]
- escape + shift = ~ [good]
- escape + command (as the mac sees it) / lalt (from VIA) = escape, not recognized by mac to cycle windows within application [bad]
- escape + shift + command (mac) lalt (VIA) = cmd+shift+~, correctly cycles windows in reverse [good]
- escape + opt (mac) / lwin (VIA) = ` [good]

The only change I want from the above status quo is to use the option mentioned at the bottom of the QMK page above called GRAVE_ESC_ALT_OVERRIDE. This should correct the third scenario above by forcing ~` behavior when alt (or cmd from mac perspective) is pressed. This shouldn't interfere with any of the other scenarios, and I don't care much about other combinations.

So the question is: How do you enable GRAVE_ESC_ALT_OVERRIDE in VIA?

As a side note, I ran headlong into this exact same problem four years ago with TMK on my mac M0110 keyboard.( Glad to see QMK nails this - may have to revive that project and get it running on QMK if this works.

User avatar

06 Apr 2021, 11:24

I have exactly this issue with my Escape keys on mainline QMK. Command + ` is important!

The trouble is there's several things I want from that one overloaded key: so when should it be ` and when should it be Escape? It's not easy to tell.

I need all of these:

Command + ` for window cycling
Option + ` for typing grave accents (àaàaà)
Command + Option + Esc for Force Quit

All I've managed is a workaround: put real Escape on the second layer and throw Fn at it when you really need Escape. Inelegant. A real fix would be welcome.

User avatar

06 Apr 2021, 19:20

I think you should be able to get at least two of those additional three requirements using the OVERRIDE options, though that last one is likely the one you'll have to sacrafice to get.

But yeah - I agree - it's been too long without a solution.

Your workaround is no good for me - VI relies so heavily on escape I can't have it move, but for others who don't use vi, that may work really well.

My intuition is that the answer is a really complicated layer map that treats shift, control,alt, and win all as function keys rather than modifiers and then manually applies the correct modifications at each layer for each combination. That approach will almost certainly be inelegant, require a lot of duplicative code, and therefore hard to port between keyboards easily.

FWIW, you might want to check out this issue on GH ( which details some of the technical challenges involved and also provides a solution if you're willing to give up having naked escape as the unmodified keypress for that key.

User avatar

10 Apr 2021, 21:29

After some research, I think this is not a VIA issue, but something that needs to happen during QMK compilation before the .hex file is provided to VIA.

Following this thread viewtopic.php?f=50&p=482419 I simply downloaded a .hex file and was not provided any source code.

I think the next step is to see if I can get the code that was compiled into that .hex and edit it.

User avatar

10 Apr 2021, 22:24

Sorry, saw this just now after a PM:

1. You need to disable the bootmagic
2. You need to change raw_hid_receive to raw_hid_receive_kb in xwhatsit/util_comm.c

Or better explained:
Go to:

Code: Select all

Open util_comm.c and at around line 38 you need to replace raw_hid_receive with raw_hid_receive_kb

That is the basic code change there. Next you go into the keyboard subdirectory you are using to compile your firmware. There you make the following additions to config.h

Code: Select all

And the following additions to

Code: Select all

Important is also to mention that I use a different product_id, so the proper json file can be loaded at a later stage. These changes also have to be added to config.h:

Code: Select all

#define MANUFACTURER    Brand New Model F Keyboards
#define PRODUCT         Brand New Model F Keyboards - F77
#define DESCRIPTION    Brand·New·Model·F·Keyboards·F77
#define VENDOR_ID 0x0481 
#define PRODUCT_ID 0x00C0

Post Reply

Return to “Keyboards”