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

Share this post

Link to post



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

Share this post

Link to post

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.



Share this post

Link to post

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.

Share this post

Link to post

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.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...