rice.shawn Posted November 8, 2013 Posted November 8, 2013 (edited) Update: rewrote the entire thing as a bash script. It's much faster now. All the links are the same. Grab it if you want. Let me know if there are any bugs. (I couldn't find any). Caffeinate Control v2 v3 I just pushed a major update to my old Caffeinate workflow, and I figured I'd just start a new thread. It is a complete overhaul. Find version 2 3 on Packal.org: packal page. Option Configuration You can configure how you want Caffeinate to work for you. Do you want to keep the system awake? Just the display? Everything? Just type "caff configure" (or "caff c"), and you can set the options easily. If you want to change how it works later, then just run the config again. Change however frequent you want! Defaults We default to "i" or just to keep the system from idling (which lets you display turn off). Just run the config and choose more options to as you please. Multiple options are available by pressing cmd while clicking. Commands Just type "caff" to get started. It will tell you the status and give you the most relevant option first. Example Arguments "caff e" enables caffeinate indefinitely "caff d" disables caffeinate "caff 15 2" enables caffeinate for 15 hours and 2 minutes "caff 23" enables caffeinate for 23 minutes "caff 2h" enables caffeinate for 2 hours "caff configure" opens the configuration dialog "caff help" opens the help dialog. Here are some screenshots: Shows the status left in hours / minutes, depending on how much time is left. You can also see the configure and help entries in the bottom. I need to get around to uninstalling caffeine because I don't use it anymore. Configure the behavior of how you want it to sleep. Just select the options and press "Set Options". If you input one number, it defaults to minutes. If you put in two numbers, it interprets as hours and minutes. You can specify with arguments too. Feel free to type out the whole words "hours" or "minutes" or whatever part of them you want to. Here's the help, explaining it a tiny bit more. Click on "More Info..." to be taken to the caffeinate man page. If you get really excited about typing a lot of minutes, then we'll still let you know how many hours that is... (edited to add more pretty screenshots.) Edited March 16, 2014 by Shawn Rice thec13, hpiwzqda, willrun4fun and 2 others 5
rice.shawn Posted November 13, 2013 Author Posted November 13, 2013 Just pushed an update to address this issue. Hence, fixed the preferences naming scheme and error handling on file open for the preferences. If you update, then you'll have to reset your preferences (which takes all of four seconds). The link in the first post is the updated one.
rice.shawn Posted November 23, 2013 Author Posted November 23, 2013 Thanks! Glad you like it. It's nice to know that these things can help other people out besides myself.
rice.shawn Posted March 7, 2014 Author Posted March 7, 2014 I just pushed a minor update to resolve an intermittent warning message that gets displayed in the notification as well as a typo. If you haven't noticed either of these, then the update isn't really necessary for you. Just find it on Packal at the same place noted in the first post of this thread.
rice.shawn Posted March 12, 2014 Author Posted March 12, 2014 Just pushed a major update. Now we're at v3. On the outside, there really aren't too many differences between v2 and v3. Yet, I found that the PHP script lagged a bit too much for my liking, so I rewrote the entire thing as a bash script. So, under the hood, just about everything is different. But, the only real difference you should notice is that it's much, much faster. As always, find it on Packal. Cheers.
rice.shawn Posted March 14, 2014 Author Posted March 14, 2014 Turns out there was a bug: for first-time users, the data directory wasn't created, so there was no place for the preferences, and, by extension, the command that was sent was bad. If you had installed a previous version, you wouldn't run into this bug. Anyway, I pushed a new version that fixes the bug onto Packal. Same place. Grab it there.
antares Posted November 10, 2014 Posted November 10, 2014 Thanks! Your workflow is very nice and simple.
Subject22 Posted January 27, 2015 Posted January 27, 2015 I'd like to use this as a toggle. i.e.: There'd just be one trigger (keyboard shortcut, keyword, remote etc.) and activating it would toggle Caffeine on (indefinitely) or off. What would be the best way to do this?
rice.shawn Posted January 27, 2015 Author Posted January 27, 2015 I didn't write this one as a toggle, so the answer is that you'd have to rewrite it... If you want one that is more of a toggle, then you can use Vítor's CoffeeCoffee. However, I do need to update it so that it works better with remote, and putting in a toggle might be the easiest way to do that.
Maddog Posted August 14, 2015 Posted August 14, 2015 I often forget to turn it off Is there a companion app that can show the state of the system Caffeinate? I found one called Caffeine but it has it's own status and does not reflect whatever I set from this plugin. thanks
rice.shawn Posted August 14, 2015 Author Posted August 14, 2015 Is there a companion app that can show the state of the system Caffeinate? There might be, but I don't know of one. However, if you just type `caff` with no argument, then the first item should tell you if caffeinate is active and for how much longer.
Kubaton Posted August 20, 2015 Posted August 20, 2015 There might be, but I don't know of one. However, if you just type `caff` with no argument, then the first item should tell you if caffeinate is active and for how much longer. I love this workflow and use it all the time. Thanks for creating it, by the way! The only minor issue I've noticed is that the time remaining does not update. If I set it for 10 minutes, wait 9 minutes, and type caff, it will show caffeinate will be active for another 10 minutes. It's no big deal but I'm curious if it's a widespread issue or an issue on my end.
rice.shawn Posted August 21, 2015 Author Posted August 21, 2015 I love this workflow and use it all the time. Thanks for creating it, by the way! The only minor issue I've noticed is that the time remaining does not update. If I set it for 10 minutes, wait 9 minutes, and type caff, it will show caffeinate will be active for another 10 minutes. It's no big deal but I'm curious if it's a widespread issue or an issue on my end. Nope. That turns out not to be just on your end but on everyone's end. I had overlooked that part. Anyway, I just put in a fix. v3.03. Is available to fix that. Kubaton 1
Kubaton Posted August 22, 2015 Posted August 22, 2015 Nope. That turns out not to be just on your end but on everyone's end. I had overlooked that part. Anyway, I just put in a fix. v3.03. Is available to fix that. I just confirmed it is working properly now. Thanks for the quick fix!
wbtrans Posted September 12, 2015 Posted September 12, 2015 Hi I just downloaded and installed the latest Caffeinate workflow v 3.3. However, it does not behave as documented. I face the two following problems: 1. If I type "caff d" it displays "Enable Caffeinate forever" instead of "Disable" (thus the same as when I type "caff e"). 2. I couldn't figure out how the options work because regardless of which option I set, I get exactly the same prompt when enabling Caffeinate after having set the options. How do know the options are being applied? Walter
rice.shawn Posted September 21, 2015 Author Posted September 21, 2015 Hi I just downloaded and installed the latest Caffeinate workflow v 3.3. However, it does not behave as documented. I face the two following problems: 1. If I type "caff d" it displays "Enable Caffeinate forever" instead of "Disable" (thus the same as when I type "caff e"). 2. I couldn't figure out how the options work because regardless of which option I set, I get exactly the same prompt when enabling Caffeinate after having set the options. How do know the options are being applied? Walter Sorry for the delay, Walter. If Caffeinate is not running, then it will only show you ways to enable caffeinate (you can't disable it if it isn't running). If it is running, then you can "re-enable it" by entering a different argument, or you can disable it. Try typing `caff e` and pressing enter and then typing `caff d`, and you should see the difference. The prompts will always be the same regardless of the options you set. If you want to verify exactly what arguments are being sent then change the options and enable caffeinate via the workflow, then open a terminal and type ps aux|grep caffeinate|grep -v grep and you should see the command line argument sent in order to enable caffeinate. The different options are just more about what caffeinate doesn't allow to go to sleep. My assumption is that users would want to set this once and never worry about it again because it's more of a general preference in how you want to keep your computer awake. Adding those options to the prompt would have added a lot more complexity to the code as well as the user interaction.
thejeffreystone Posted July 14, 2016 Posted July 14, 2016 (edited) Doesn't appear to work on clean install of Alfred 3 on OSX 10.10.5. Initial errors were due to not being able to create the "Alfred 2" directory: [2016-07-14 16:18:18][STDERR: input.scriptfilter] mkdir: ~/Library/Application Support/Alfred 2/Workflow Data: No such file or directory Then trying to find the directory it couldn't just make or the preferences: [2016-07-14 16:18:23][ERROR: action.script] action.sh: line 12: ~/Library/Application Support/Alfred 2/Workflow Data/com.shawn.patrick.rice.caffeinate.control/preferences: No such file or directory cat: ~/Library/Application Support/Alfred 2/Workflow Data/com.shawn.patrick.rice.caffeinate.control/preferences: No such file or directory I found on that on June 12 the Github repo was updated with a fix for this, but it is missing from the app downloaded from Packal. So I just updated the two scripts from the github repo manually. Next error in debug was it couldn't find the preferences file in in the "Alfred 3" folder, so at least we are getting closer: [2016-07-14 16:13:21][ERROR: action.script] action.sh: line 12: ~/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.shawn.patrick.rice.caffeinate.control/com.shawn.patrick.rice.caffeinate.control/preferences: No such file or directory cat: ~/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.shawn.patrick.rice.caffeinate.control/com.shawn.patrick.rice.caffeinate.control/preferences: No such file or directory And sure enough "/com.shawn.patrick.rice.caffeinate.control/com.shawn.patrick.rice.caffeinate.control/" doesn't exist in that path. So I tried to create a preferences file based on the data in the debug window. I got the errors to stop, but the workflow never starts caffeinate despite showing a notification that it was started every time. I'm guessing this works if you upgraded from Alfred 2, but I'm not to the point of trying that to see. Edited July 15, 2016 by thejeffreystone
rice.shawn Posted July 28, 2016 Author Posted July 28, 2016 I just (finally) pushed an update that should make this work out of the box with Alfred 3 as well as 2. Find the update on Packal, and let me know if there are any problems.
macosxguru Posted July 29, 2016 Posted July 29, 2016 I just (finally) pushed an update that should make this work out of the box with Alfred 3 as well as 2. Find the update on Packal, and let me know if there are any problems. I wrote about Caffeinate Control here. http://ipadpedia.net/alfred_workflow_01_caffeinate_control macosxguru
bswiftly Posted January 27, 2017 Posted January 27, 2017 Just started getting an error today from php: strtotime() "its not safe to rely on the systems timezone settings". I went into the config files, not sure if there's something I could override to get around this for now?
sburlot Posted January 28, 2017 Posted January 28, 2017 22 hours ago, bswiftly said: Just started getting an error today from php: strtotime() "its not safe to rely on the systems timezone settings". I went into the config files, not sure if there's something I could override to get around this for now? If you update to the latest version, you wont see the error because it doesn't use php anymore.
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