Auto-Close Apps When All Windows Have Been Closed

I implemented a preset which closes specific apps when they've been inactive for a while.

autoclose-apps.bttpreset (8.0 KB)

This is a JavaScript script triggered by deactivation of an app.

Right now, the configuration is straight in the source –30 minutes of inactivity for the following apps:

  let delaySeconds = 60 * 30;

  const allowedBundleIds = [
    "com.microsoft.Excel",
    "org.mozilla.firefox",
    "com.apple.iWork.Keynote",
    "com.apple.iWork.Numbers",
    "com.apple.iWork.Pages",
    "com.microsoft.Powerpoint",
    "com.apple.Preview",
    "com.apple.Terminal",
    "com.microsoft.Word"
  ];