Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: key binding for Command-Q not working after upgrade from 0.9.0 to 0.10.0 #6136

Open
kittyflat opened this issue Jun 15, 2022 · 16 comments

Comments

@kittyflat
Copy link

kittyflat commented Jun 15, 2022

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?

@chrisduerr
Copy link
Member

Can you share your full config?

@kchibisov
Copy link
Member

Will likely be fixed by #6079.

@chrisduerr
Copy link
Member

Can you test #6079 @kittyflat?

@kittyflat
Copy link
Author

I don't think it's been fixed in #6079. Just to be sure I did the right steps: I cloned kchibisov/alacritty, checked out the branch update-winit-0.27, and then followed the osx build instructions here. After quitting and restarting Alacritty, pressing Cmd+Q still caused Alacritty to quit, however Cmd+W still did not close the window. This was the same behavior as described in the original issue

@kittyflat
Copy link
Author

Issue is not present on v0.9.0 but I was able to reproduce the issue starting on release v0.10.0-rc1

@chrisduerr
Copy link
Member

@kittyflat Thanks for the feedback. Just to be 1000% sure, did you run cargo run to execute the compiled application, or did you install the Alacritty.app?

@kittyflat
Copy link
Author

@chrisduerr I didn't use cargo run. Am I supposed to? I did:

make app
cp -r target/release/osx/Alacritty.app /Applications/

and then quit/restart Alacritty

@chrisduerr
Copy link
Member

chrisduerr commented Jun 26, 2022

Your solution should work too, but cargo run just skips the install step and thus avoids a possible failure point.

@unphased
Copy link

unphased commented Jun 27, 2022

Confirmed that the workaround that works for Hide alacritty (via making a shortcut in Keyboard preferences to override it) does not work to disable Command+Q on v0.10.1.

Personally I'm fine with the way it works now since I'd actually prefer to have hotkey to kill the terminal but I may decide one day that I want to bind Command+Q. So far I've bound Ctrl+Q and Shift+Q and thats enough.

@w-r-z-k
Copy link

w-r-z-k commented Jan 13, 2023

This is also not working on 0.11.0. Rebinding Command-Q to None still results in Alacritty quitting when Command-Q is pressed.

Why this is a problem is that occasionally when editing in vim I mean ":w" and instead my mind hits Command-W. I miss. And hit Command-Q instead. Thus ending my editing session without saving. Ouch!

@gplusplus314
Copy link

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.

@artursmirnov
Copy link

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.

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.

@alvarosevilla95
Copy link

This is still broken in 0.12

I'm also unable to override both "Hide alacritty" and "Quit alacritty" via a keyboard shortcut in system settings. I define an override there, but the default behaviour remains.

Only option for me is to switch to a different terminal at this point :(

@unphased
Copy link

unphased commented Jul 5, 2023

Check your menu to see if your override took effect:

image

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.

image

@alvarosevilla95
Copy link

alvarosevilla95 commented Jul 9, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

8 participants