vitor Posted July 15, 2019 Posted July 15, 2019 This workflow is officially deprecated in favour of Alfred’s Automation Tasks. You can find the old source on Github. Call qapps and all apps excluding the ones you set in the keep_alive Workflow Environment Variable will quit. The Finder and Alfred (including Alfred Preferences) are added to the exclusion list by default, unless you set their kill_ variables to true. You can exclude extra apps on a per-run basis by adding them as arguments. Calling with ⌘↵ will also exclude the frontmost app. Use the exact application names as they present themselves to the system. To prevent multiple apps from quitting, separate their names with commas. qprocesses will kill all processes, subject to the same keep_alive and kill_ settings, meaning even things in the background that you don’t see will be asked to quit. The External Triggers allow to temporarily override which apps to keep alive by passing them as the argument. Note both options ask the apps to exit (SIGTERM) instead of telling them (SIGKILL). If you need to force individual processes to terminate, use ProcessControl instead. cands, gohoyer, JJJJ and 2 others 5
Eric Lin Posted July 17, 2019 Posted July 17, 2019 This is really useful. Thank you for making this workflow! vitor and CuteCat 2
vitor Posted June 14, 2020 Author Posted June 14, 2020 Update. Added External Triggers. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.
mgs1000 Posted June 18, 2020 Posted June 18, 2020 Sorry to be a dummy - where do I enter the names of the apps to keep alive? zlc1952 1
Vero Posted June 18, 2020 Posted June 18, 2020 @mgs1000 Here's where you can set your environment variables for the workflow: https://www.alfredapp.com/help/workflows/advanced/variables/#environment
mgs1000 Posted June 18, 2020 Posted June 18, 2020 Actually - even more of a dummy - since the update it doesn't seem to quit the apps anymore. Is there an input needed from me?
vitor Posted June 18, 2020 Author Posted June 18, 2020 (edited) 3 hours ago, mgs1000 said: Actually - even more of a dummy - since the update it doesn't seem to quit the apps anymore. Is there an input needed from me? I’m confused. First it seemed like you’d never used the Workflow and now you’re saying it’s not working anymore, implying you had it working previously. Which is it? I’ll need to know your steps so I can help you debug. Edited June 18, 2020 by vitor
vitor Posted August 20, 2020 Author Posted August 20, 2020 Update. New icon, and Alfred (including Alfred Preferences) now have their own exclusionary variable like the Finder. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.
vitor Posted January 11, 2021 Author Posted January 11, 2021 Update. You can now add apps to the keep_alive list on a per-run basis, by adding them as arguments on the Keyword. Also, ⌘↵ is a shortcut to add the frontmost app. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.
Kelson01 Posted January 30, 2022 Posted January 30, 2022 This workflow quits working from time to time and I can't seem to figure out why. In this screenshot is the script that is causing the problem and you can see the debugger. The second screenshot is the variables for the workflow. I have not changed anything since I installed this workflow and I'm just now getting this error after it working fine for a long time. Am I doing something incorrectly here?
vitor Posted January 30, 2022 Author Posted January 30, 2022 11 hours ago, Undertaker01 said: I have not changed anything since I installed this workflow and I'm just now getting this error after it working fine for a long time. Yo’ve changed plenty of things, only outside the Workflow. One of your apps is the likely culprit. When it happens, run osascript -l JavaScript -e "Application('System Events').applicationProcesses.where({ backgroundOnly: false }).name()" in a Terminal and check what’s running. Also:Make sure you’re on 22.1, just released (basically code cleanup).When asking for help, always include your Alfred and macOS versions.
Kelson01 Posted January 31, 2022 Posted January 31, 2022 On 1/30/2022 at 7:11 AM, vitor said: Make sure you’re on 22.1, just released (basically code cleanup). When asking for help, always include your Alfred and macOS versions. Noted. My bad. Big Sur & Alfred 4.6.2 and I've just updated the workflow to the latest version. I'll see what happens when I use it again, thanks!
Kelson01 Posted April 15, 2022 Posted April 15, 2022 On 1/30/2022 at 7:11 AM, vitor said: Yo’ve changed plenty of things, only outside the Workflow. One of your apps is the likely culprit. When it happens, run osascript -l JavaScript -e "Application('System Events').applicationProcesses.where({ backgroundOnly: false }).name()" in a Terminal and check what’s running. Also: Make sure you’re on 22.1, just released (basically code cleanup). When asking for help, always include your Alfred and macOS versions. Okay, I've narrowed it down to Spotify being the issue. When I run the workflow with Spotify running I get an error, nothing is quit and nothing happens. When I add Spotify to the keep_alive list, the workflow runs with no issue and quits all apps. I've added Spotify to the keep_alive list and the workflow runs without issue. Sometimes it takes a little long after I run it for anything to happen and quit apps, but apart from that no complaints. Sorry for the delayed reply! Alfred 4.6.4 I'm using v22.1 of the workflow macOS Monterey 12.3.1
vitor Posted April 15, 2022 Author Posted April 15, 2022 I can’t reproduce, but Spotify also doesn’t run properly on a Virtual Machine (and I don’t trust them to install it on my main one) so no idea what the heck they’re doing. All the Workflow does is ask (not tell) apps to quit. You haven’t posted the result of the command you quoted. Does Spotify show up as Spotify or something else?
Kelson01 Posted April 16, 2022 Posted April 16, 2022 On 4/15/2022 at 9:09 AM, vitor said: I can’t reproduce, but Spotify also doesn’t run properly on a Virtual Machine (and I don’t trust them to install it on my main one) so no idea what the heck they’re doing. All the Workflow does is ask (not tell) apps to quit. You haven’t posted the result of the command you quoted. Does Spotify show up as Spotify or something else? -- I added Terminal to the keep_alive list for this demonstration, Safari is also on the keep_alive list but it is not running. But no matter what apps are and aren't on the keep_alive list, I always get an error when Spotify is not listed there. This screenshot shows a successful run of the QuitArena workflow with Calendar, Preview & Books open. I ran the command after a successful run of the workflow revealing that the apps were quit. After that I opened Spotify and tried to run the workflow and got an error. Here's it with the same apps that were successfully quit before, with the only difference being that Spotify is running. -- Okay now i'll add Spotify to the keep_alive list Here is Spotify on the keep_alive list Now running the workflow with the same apps + Spotify on the keep_alive list I've tried this with all different combinations of apps running, I haven't had it fail at any point other than when Spotify was running and not on the keep_alive list. I've just added it to the keep_alive list and moved on, for me it's not the end of the world. Thanks for the great workflow! Alfred 4.6.4 Workflow v22.1 Monterey 12.3.1 vitor 1
davidwain Posted August 26, 2022 Posted August 26, 2022 Does this still work with Alfred 5? Can you explain exactly where we put the list of apps we want to keep alive? For me it's doing the opposite.
vitor Posted August 27, 2022 Author Posted August 27, 2022 20 hours ago, davidwain said: Does this still work with Alfred 5? Yes, all my Workflows do. But this functionality has been ported to Automation Tasks as well (under macOS), so I recommend using that for your own bespoke setup.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now