alacritty: Typing at sign (@) and pipe (|) doesn’t work properly

I’m using a German keyboard. Usually, in macOS, it works like this:

  • @ is accessed via alt + L
  • | (pipe) is accessed via alt + 7

Using zsh with vim mode alt + L seems to send an Escape, alt + 7 also sends an Escape and moves the cursor to the beginning of the line.

There is a way to type these two characters, however: if I first type alt + n (would normally make a ~) and then type the combination for @ or | they appear.


Which operating system does the issue occur on? macOS

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 35 (8 by maintainers)

Most upvoted comments

What helped me is to set alt_send_esc to false.

Hey all - new wiki page for keyboard mappings! https://github.com/jwilm/alacritty/wiki/Keyboard-mappings

For French on MacOS :

Probably some keys still missing

  - { key: Equals,    mods: Command,    action: DecreaseFontSize              }
  - { key: Slash,     mods: Command,    action: IncreaseFontSize              }
  - { key: A,         mods: Command,    action: Quit                          }
  - { key: Z,         mods: Command,    action: Quit                          }
  - { key: L,         mods: Alt|Shift,  chars: "|"                            }
  - { key: Key5,      mods: Alt,        chars: "{"                            }
  - { key: Minus,     mods: Alt,        chars: "}"                            }
  - { key: Key5,      mods: Alt|Shift,  chars: "["                            }
  - { key: Minus,     mods: Alt|Shift,  chars: "]"                            }
  - { key: N,         mods: Alt,        chars: "~"                            }
  - { key: Period,    mods: Alt|Shift,  chars: "\\"                           }

What helped me is to set alt_send_esc to false.

@kaikuehne That helped a lot. No need to add weird bindings. Thank you very much!

The problem is still there, you can’t enter @ or | in Alacritty on a German keyboard (with alt+l and alt+7). But using alt+e to enter the €-symbol works just fine.


The workaround mentioned by @johnnynia works. The hex code for | is \x7C.

This enables you to enter @ with alt+l and | with alt+7:

  - { key: L,        mods: Alt,     chars: "\x40"                        }
  - { key: Key7,     mods: Alt,     chars: "\x7C"                        }

I experienced the same problem with the @ sign using a Swiss German keyboard (where @ is typed via alt+g.

I fixed it with this line in the config:

  - { key: G,        mods: Alt,           chars: "\x40"                        }

I’m using a german keyboard, too. But none of those keymappings in the wiki do work for me. Except Alt + 5, Alt + 6, Alt + 8, Alt + 9. Those work out of the box even with default config yml.

Basically, I have the same issue like #2390 , but alt_send_esc: is already false. No solution for me…

Using the newest source (https://github.com/jwilm/alacritty/commit/2a6e9843eaa583b67d9b853f396dd72e69a20585)

Oh shit! I mixed this repository with the iTerm2 repository. Sorry for the noise

Hi guys. Here are the mappings for Spanish keyboard in MacOS:

  - { key: Caret,    mods: Alt,     chars: "\x5C"                        }
  - { key: Key1,     mods: Alt,     chars: "|"                           }
  - { key: Key2,     mods: Alt,     chars: "@"                           }
  - { key: Key3,     mods: Alt,     chars: "#"                           }
  - { key: Key6,     mods: Alt,     chars: "¬"                           }
  - { key: LBracket, mods: Alt,     chars: "\x5B"                        }
  - { key: RBracket, mods: Alt,     chars: "\x5D"                        }
  - { key: Apostrophe,  mods: Alt,  chars: "\x7B"                        }
  - { key: Backslash,   mods: Alt,  chars: "\x7D"                        }

@jacoscaz make a wiki page! 🎉

Useful mappings for those with an Italian layout on MacOS:

  - { key: LBracket,    mods: Alt|Shift,      chars: "\x7B"              }
  - { key: RBracket,    mods: Alt|Shift,      chars: "\x7D"              }
  - { key: LBracket,    mods: Alt,            chars: "\x5B"              }
  - { key: RBracket,    mods: Alt,            chars: "\x5D"              }
  - { key: Semicolon,   mods: Alt,            chars: "\x40"              }
  - { key: Apostrophe,  mods: Alt,            chars: "\x23"              }
  - { key: Caret,       mods: Alt,            chars: "\x60"              }
  - { key: Key5,        mods: Alt,            chars: "\x7E"              }

On MacOS, mappings can be derived by:

  1. running make app as per the installation guide
  2. running Alacritty using ./target/release/osx/Alacritty.app/Contents/MacOS/alacritty --print-events

At this point, Alacritty should log events pairs like this:

glutin event: WindowEvent { window_id: WindowId(Id(140237741461568)), event: KeyboardInput { device_id: DeviceId(DeviceId), input: KeyboardInput { scancode: 33, state: Pressed, virtual_keycode: Some(LBracket), modifiers: ModifiersState { shift: false, ctrl: false, alt: true, logo: false } } } }
glutin event: WindowEvent { window_id: WindowId(Id(140237741461568)), event: ReceivedCharacter('[') }

We’re interested in:

  • The value in between the brackets of Some, which is the one to use in the key property of the mapping
  • boolean properties in ModifiersState, which indicate which modifiers to add in the mods property of the mapping (these can be concatenated using the | character)
  • hex values for the chars properties can be looked up on ASCII tables like the one at http://www.asciitable.com

In the case of the above log lines, I was looking for a mapping that would make pressing [ on my keyboard actually result in the desired symbol appearing in Alacritty. The resulting mapping is:

  - { key: LBracket,    mods: Alt,            chars: "\x5B"              }

Edited: added mapping for ~

I had the same problem, and I fixed it in the “Profiles --> Keys” configuration tab. I set the Right ⎇ Key to “Normal” and my symbols came back. image

Thank you, that’s a nice workaround!