alacritty: MacOS: key binding for Command-Q not working after upgrade from 0.9.0 to 0.10.0
I have the following key binding configs to prevent accidentally exiting the terminal:
# Disable Cmd-W and Cmd-Q to prevent accidental exit
- { key: Q, mods: Command, action: None }
- { key: W, mods: Command, action: None }
After upgrading Alacritty from version 0.9.0
to 0.10.0
(and/or 0.10.1
), the Command-Q
no longer works and causes Alacritty to quit on version 0.10.0
and 0.10.1
. However the key binding for Command-W
still works (as in it does not close the window). Is this expected behavior or an issue?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 16 (5 by maintainers)
Thanks for your message. I had tried this but the override would just not work. This was using alacritty installed through homebrew. After your message I decided to try again but with the latest release from here on Github, and it works now 🤷
I’m possitive I was doing it correctly before (I’ve added shortcuts for different apps before), so not sure what’s up with that. Either way, it’s working now, so thanks again!
Check your menu to see if your override took effect:
I have overridden successfully the Hide function since I need Cmd+H. I’m cool with Cmd+Q but do hit it accidentally a few times a year, but since i use tmux this is a nonissue.
You need to define a Keyboard Shortcut to override an existing function, and the name has to match.
Why does Alacritty register “Quit” with shortcut, if it causes issues? It isn’t required by the system as far as I know. At least, iTerm allows to override Cmd-Q without any issues (in the similar way it worked in Alacritty before). Even web browsers are overriding Cmd-Q to prevent accidental quits. And for terminal emulator it’s absolutely unacceptable to simply shut down without any questions.
Indeed, there are ways to prevent this behavior using external tools, but it’s basically just monkey-patching the issue in Alacritty. Also if you’d need to bind an action to Cmd-Q, it isn’t possible with external tools.
This is because
Cmd-q
is part of the native macOS menu that Alacritty registers, so the hotkey is handled at the operating system level. Thankfully, you can work around this by overriding the keybind in the system Settings app in the Keyboard section. Add Alacritty as an “other” app and just follow the instructions on the screen. You can’t delete it, but you can change it to something completely out of the way.Can you test #6079 @kittyflat?