Description of what you are sharing
Latest Update: 01.12.2023
Opt-in for Apps!
Only works for Apps you choose and add to the Conditional List. See How-to for more information.
. What the preset is for:
If there is only one window left, the App will quit, when the red button of the window is clicked.
. How it works:
If you want to add an Application, which should quit with the last open window, you have to do the following steps.
Change in Settings > Advanced Settings > Scripting BTT
-> Turn on "Allow external BetterTouchTool Scripting
Click on the Trigger 'Leftclick Red Window Button'.
2b. Click in this, the second Action (the one with all the conditions in it)
2c. Click on the button 'Advanced Conditions...' (Bottom right) -> This is the list of all apps that will quit - with the last open window being closed.
To add an app, click on the plus-button of the last item. -> (You can delete an item by clicking on the minus-button of the line.)
Copy the text from the Item before and change the name in-between the "..." to the name of the application you want to add. The exact name can be seen, when you hover with the mouse over the icon of the app in the Dock. It has to the correct spelling and capitals.
Try one after the other after restarting BTT. Please tell me which one was the problem
You need to have both presets installed
In the Settings ‘Advanced Settings > Scripting BTT’ turn on ‘Allow external BetterTouchTool Scritping’
(after trying CMD+w, you should see the variable ‘closeThatThing: false’ in this list)
Try to reconnect the named triggers:
Klick on the second action (in your picture) in the middle coloum with the ABC icon. Then choose from the dropdown menue on the right ‘Named Trigger > Named Trigger: Close That App’
Do this for the fourth action also with ‘Named Trigger: Close That Window’
Great tool. thank you!
the CMD+W preset worked for me. I guess @hu_hao maybe you've duplicated trigger for CMD+W. first delete all. related presets and disable others then test it.
Although I should say this CMD+W is not perfect yet. cause it would CMD+Q in some apps like Safari which it should close just the current tab.
Another bug of this is the trigger condition depends on the location of mouse pointer (hover) so because of the keyboard shortcut it may close inactive app! (because the mouse pointing at that app's windows)
For the CMD+W version I suggest to check and trigger just on the CURRENT app. like mac OS used to be.
And there is a bug in the main "Red Button" preset as well: If you have some unsaved work on TextEdit it won't alert you before it quit it completely (although it restore from where you were after opening again)
hi @omn_ia that variable is defined as false every time you click on the red button. If the app is listed in the conditions of 'CloseThatApp', then it will be set to 'true'. Which cancels out the next 'CloseThatWindow'. If it stays false, 'CloseThat'Window' will be executed. This is also explained at the end of my initial posting
Look in the conditions of 'CloseThatWindow'. There you'll see the condition that the variable has to be 'false'.
And this is the reason, why I call CTApp before CTWindow. The other way around would make no sense.
Thanks for your feedback on CMD+W. I do not use this. Because of the mentioned problems. The command has the purpose of closing windows, not apps.
F.e. nn the case of Safari, you won't be able to close the open tabs of the last window with this setup.
There are workarounds, but they are complicated. And it is way easier to just press Q instead of W.
And if you are already pressing a combination, I see no purpose in this to be honest.
@hu_hao I guess you should delete all that is related to this setup and reinstall the presets. It should work, like for @omn_ia
If you press CMD+Q yes it will close open windows immediately even if there is an ongoing progress but if you press CMD+W (or tap on the Red button of windows) it will prompt to save the ongoing document.
With your preset when I tap on the Red button of an in-progress window it quit immediately and doesn't prompt for saving the unsaved document as it should.
It I didn't clarify this behavior right tell me to send the screenshots.
Actually it has a benefit because if you have no open windows of an app it make no sense to keep app open. I don't like CMD+Q cause its like a hammer! It will close all open windows immediately even though maybe there is some window I didn't aware of. So I prefer to close each open window (open document in TextEdit) to close one by one and in just in that situation quit the app entirely. some apps has this behavior out of the box like iTerm. If you close all of its tabs and windows it will quit as well (and didn't stay open in the background with little dot beneath of its icon)
Yeah you're right. I too like this way more. But as far as I can tell. OSX has no one way of handling that anymore. The more newer Apps from Apple close the App when you click the red Button on the last Window. But CMD-W does not as far as I know ;(
I did not really understand what your use case is. So maybe capture a screenrecoding where I can see what happens.
PS. Sorry for the delay. University did say no to free time
I just found about your preset but it doesn't work for me, in fact it breaks my red button. Whenever I click no matter which app I'm on (and if it's in the trigger list or not) just nothing happens. Any idea how to troubleshoot this . I'm on latest Sonoma 14.1.1