Jump to content

Coffee -- Yet another Caffeinate Workflow (Updated: 09 Nov 2013)

Recommended Posts

Another caffeinate workflow (uses the built-in "caffeinate" tool, *not* the third-party "Caffeine" app).  Unlike the ones I found already, this one uses the result feedback mechanism extensively.



You can create jobs with custom times.  Any custom jobs you create are remembered and presented in the order of frequency of use.  For instance, if you create a custom caffeinate job of 45 minutes once, it will show up in your list from the next run.  And depending on how often you re-use that, it will bubble up or settle down in the list of available choices.


And, of course, you can cancel existing jobs or reschedule them.cancel.png

This is how you configure the workflow if, for instance, you want display sleep to blocked too.


This is the config file you'll need to edit to configure the caffeinate flags:


Download it here: https://github.com/venkytv/alfred-caffeinate/raw/master/Alfred-Coffee.alfredworkflow


Source: https://github.com/venkytv/alfred-caffeinate


Written in perl and has no external dependencies.  Will use the Time::Duration module, if available.

Edited by Venky
Link to comment
  • 2 weeks later...



I think that the workflow doesn't work properly (or maybe it's normal). When I activate Coffee, my computer doesn't go to sleep but the monitor does. The thing I like with Caffeine (the app) is that everything stays awake.


Would it be possible to correct that?


Thanks. :)

Edited by tbnv
Link to comment

Check the arguments in the command itself.


It has these:

i   -- prevent idle sleep

d  -- prevent display sleep

s  -- prevent system sleep

u -- emulate user activity (this means that you computer will stay awake even if the lid is closed... be careful if you're on a laptop).

m -- prevent disk sleep (mavericks only).


Check the command issued in the workflow to make sure that it has "d" in the options.


Generally, when I invoke Caffeinate I use:

caffeinate -di -t <TIME> &

That's my preferred method. Not to hijack, but I just came across this thread as I was posting the second version of my old caffeinate workflow. I won't link, but you can find it on the forum.



Link to comment

Thanks, Shawn.


Have added a new version which allows this behaviour to be configured.  Nothing as fancy as Shawn's latest workflow -- this just opens up a text editor and allows you to set up the caffeinate flags.  Type in "coffee conf" to open the configuration file.  To prevent the monitor from going to sleep too, remove the '#' character from the beginning of the line that says "#CAFFEINATE_FLAGS=-ids" and close the file.  Look at the manual page of "caffeinate" for other options.

Link to comment

Glad to help, Venky.


If you feel like implemented the fancier version of the config, then feel free to just take the code in mine and modify it to suit your needs. That goes for anyone else who happens to be reading this who want a fancy way to deal with simple configuration in any of your workflows.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...