0

This question already has an answer here:

As of now it's set to Q everywhere which is very unintuitive and being next to W, which I use a lot, it's very annoying too.

Esc doesn't do anything (on my laptop at least) and I think it makes sense to remap the quit action to it. I think I can do it one by one - one app at a time. But is there a way I can change it for all the apps at once - from one setting, or using some tool?

And I would like Q to do something else or nothing at all.

marked as duplicate by Lizzan, oa-, Allan, Ɱark Ƭ, fsb Oct 16 '17 at 11:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Well this sure turned out to be a question that seemed simple, but snowballed into a hassle to solve.

I'm going to kind of start from the beginning:

Turns out disabling +Q natively is only possible if you are ok with actually just replacing it with another function. Just outright disabling it is a no go... But, some third party apps can overwrite it. I'll get to that later. Also, as simple of an idea as it seems, you can't set a new shortcut for "Quit" through the native keyboard shortcut editor thing, because that relies on the full menu item name and wouldn't you guess it, it's most often: "Quit {application name}" so it's impossible to target all apps with that single shortcut.

Then I thought... Alright, how aboutAutomator Service. I could use an apple script to close applications with that... Well, you can't set the shortcut +Esc for Automator Services apparently, but you can set that shortcut globally in some third party apps, which is the way I ended up doing it all.

Solution:

So I tried to find the cheapest third party app I have that can do all that we want to happen, enter BetterTouchTool.

Karabiner should be able to do this for free, but a version that works in Sierra and later is under a rewrite, not sure if it currently has the power to do it...

  1. In BTT, I made a new global keyboard shortcut +Q and defined no action for it, essentially disabling it.

  2. Then I made another shortcut: +Esc with the predefined action Run Apple Script in background:


tell application "System Events"
    set frontmostApp to name of the first application process whose frontmost is true
end tell
tell application frontmostApp to quit

You should know that this applescript should work in most applications, but not all of them. I'm not aware of a bulletproof way to do it.

This shortcut could just be "Trigger other keyboard shortcut: Cmd+Q", but since we disabled that shortcut, that is no longer an option.

enter image description here

That's it.

Not the answer you're looking for? Browse other questions tagged .