Auto Quit Apps - Quitter app functionality

Hi everyone!

Is there a way Keyboard Maestro can help with functionality like the Quitter app….it functions in a way that…if an app is inactive or not used for X minutes, it is killed (or hidden based on what you configure). This helps keep your mac memory, task switcher, and dock with stuff that you are really using.

You could do something sort of close, but it's going to be a complex.

You'd need to come up with some way of finding out when an app is idle. This is the hard part; the macOS Terminal has no visibility to GUI activities, so relying on its idle time values in ps, for instance, probably won't help much.

One possible way to do this would be to have one macro with three triggers:

  • Any application activates
  • Any application launches
  • Any application quits

Then inside that macro, you'd store start and stop times for each application, updating the relevant value whenever an app activates or launches. When it quits, you'd remove its entry from your variable array or JSON or dictionary or whatever you choose to use.

Then you'd need another polling macro that simply checks that variable every (time interval between now and last used for each app) and either quits or hides the app, depending on how you set it up.

This will be messy and complicated and very time consuming to create. Instead, I recommend you just let macOS worry about it. It's really good at memory management. Back when I had an 8GB laptop, I used to leave 30+ apps running, and it had no issues whatsoever. The OS will free up RAM from idle apps when it needs it.

Yes, your app switcher will be messier, but you could use a third-party app switcher that lets you hide apps without windows, for instance.

Anyway, it's doable to a degree but complicated, and in my opinion, isn't worth the effort it'd take to set it up. And if Quitter already does all this well, then just keep using it :).

-rob.

1 Like

Oh. This would be creating an app in itself, except the UI is Keyboard Maestro😄.

I'm realizing more and more that it is difficult to consolidate all these single function utility apps into apps like Keyboard Maestro - or maybe I've reached the limit of whatever can be consolidated has been.

Any way….about :down_arrow:
third-party app

Do you have any recommendation that fit my use case

I don't have any recommendations, as I didn't even know this was a thing. Your mention of Quitter was the first I heard. As I said, I just don't even care—I open apps and leave them open for days or weeks or months, and pay no mind.

-rob.

1 Like

Although this will not provide solution it does address one of your points.

I had similar thoughts when I first started using Keyboard Maestro to consolidate everything in Keyboard Maestro as the one app that did it all.

I spent a lot of time trying to replicate the functionality of Moom and in the end came to realize that:

a) It was not worth the effort for a number of reasons including Moom did a lot more than just move and resize windows (which I use and greatly value), the effort required was massive and as it is Apple Scriptable I could easily incorporate its functionality in Keyboard Maestro macros when needed (which I do). Plus Rob is great to work with and super helpful!!

b) The view I now have is to let Keyboard Maestro do what to does best (i.e., automation) while incorporating third party apps (i.e., Moom) into Keyboard Maestro macros / actions when appropriate.

c) This for me means i) Keyboard Maestro automates everything except window management ii) Moom manages my windows (i.e., triggers are assigned directly to Moom) and iii) Moom is included in a number of my apps to save / restore layouts, organize screens / windows, etc.

I suggest / think you will find this the better way o go in the long run.

Trust this is helpful from someone who started with teh same perspective as you!

A relatively easy way to do this would be something like this.

Say you want your idle timeout to be around 5 minutes.

Trigger your macro periodically every 5 minutes.

  • If application XYZ is running and not at the front
    • If "Quit Application XYZ" is 1
      • Quit Application XYZ
      • Set variable "Quit Application XYZ" to 0
    • else
      • Set variable "Quit Application XYZ" to 1
  • else
    • Set variable "Quit Application XYZ" to 0

So basically, set an application-specific variable to 1 if the application is running but not at the front, and if that status repeats the next time the macro fires, quit the application.

The app will be quit sometime between 5-10 minutes after it is left in the background.

Add a macro for each application, that is triggered on activation of application XYZ and set "Quit Application XYZ" to 0. That way if you use the application even briefly the timer will reset.

2 Likes