alacritty: Binding to "Grave" key stopped working

Just updated Alacritty here on macOS 10.13.4 and one of my critical keybindings stopped working.

This doesn’t work anymore:

https://github.com/bugeats/dotfiles/blob/master/src/config/alacritty/alacritty.yml#L200

But this does still work:

https://github.com/bugeats/dotfiles/blob/master/src/config/alacritty/alacritty.yml#L188

Both are configured to send the same character. My only guess is that Grave is no longer identified.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 26 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for the clarification. I’ve updated the #1403 PR and removed this issue from the list of problems solved by it.

So, the reason that hack results in receiving a grave character is because of the doCommandBySelector handler, which is implemented to just return the characters associated with the most recent key down event. This was done so that Ctrl+C/etc. would generate characters, since those don’t trigger insertText and instead trigger doCommandBySelector:noop. Cmd+Grave also triggers doCommandBySelector:noop, but no other NSTextInputClient handlers.

So, new more sophisticated hack idea:

  • General key down/up handing would still be done through the responder chain, setting a flag to indicate it’s being received the normal way
  • The event loop would forward key down/up events to custom WinitView methods that place KeyboardInput events into a queue
  • Every call to insertText or doCommandBySelector would reset the flag and queue; normally the queue is just discarded
  • If doCommandBySelector is triggered and the flag isn’t set, then the key events in the queue are sent to the user, instead of the regular ReceivedCharacter event generation behavior

I know I insinuated I didn’t want to work on this, but I’m unfortunately addicted to problem solving. I’ll try to implement this tomorrow.

  1. This originates in winit, specifically a result of tomaka/winit#518.
  2. When reporting issues about keyboard handling, always include the input method + layout. For instance, grave will be interpreted rather differently on the US international layout, which is something winit was oblivious to before.
  3. I recommend that someone other than me looks into fixing this, since A) it’s probably not too hard, and B) I already have a lot on my plate, so I wouldn’t be able to get to this for a while.

@unphased the <C-Tab> issue was fixed in winit in https://github.com/tomaka/winit/pull/629, which should get into https://github.com/jwilm/alacritty/pull/1403, hopefully pretty soon

Well, it’s messy, but it seems to work: https://github.com/francesca64/winit/tree/macos-grave

@bugeats let me know if this works for you. It would also be good if other people tested this, in case of regressions.

Do other apps allow you to use this shortcut?

Not in my experience. Alacritty has a very raw keybinding experience on macOS and everything must be specified. I personally like it this way, and I’ve used it to my advantage. The Command + Grave combo is the system-wide convention for flipping between windows, scoped by application. In my case, I use it to navigate tmux sessions.