onebadidea / swiftquit

Automatic quitting of macOS apps when closing their windows.
GNU General Public License v3.0
285 stars 14 forks source link

fixes #3: quit apps after 2 seconds delay #9

Closed incanus closed 1 year ago

incanus commented 1 year ago

There are a multitude of ways to accomplish this, but I thought this one was the simplest.

The current code checks in closeApplication() that the app in question has "one window", which really means that it just closed its last window.

The new code just uses the same app object that received the window destroy event (passing it) and checks it after two seconds to make sure it doesn't have any windows now. This allows the user to, say, reopen a window for the app after closing the last one, as long as it is inside of two seconds.

Two seconds seems fair to avoid any problems with, say, re-launching a manually quit app.

This also requires removing @objc from closeApplication(), where it's not clear why that was there in the first place anyway.

incanus commented 1 year ago

On second thought, this would also accomplish the same thing as #8 since the post-tab-closing delay would also see a remaining window after the tab close.

Moolynx commented 1 year ago

Looks like onebadidea has stopped updating this app. @incanus Is there anyway, I could download the fixes you applied? I am not a programmer, so it has to be compiled app.