Caffeine
Prevent your computer from going to sleep
If you have problems with your PC locking or going to sleep, caffeine will keep it awake. It works by simulating a keypress once every 59 seconds, so your machine thinks you're still working at the keyboard, so won't lock the screen or activate the screensaver.
The icon is shown above - it's the leftmost one in the task tray, and this is all you see. Double-clicking the icon empties the coffee pot (that's what the icon is) and temporarily disables the program. Double-clicking it again refills the pot, and will keep your machine awake.
By default the app starts enabled, and works every 59 seconds. There are some command line switches you can use to alter this behaviour:
xx
- where xx is a number which sets the number of seconds between simulated keypresses. This must be the first text on the commandline-startoff
- application starts disabled.-exitafter:xx
- application will terminate after xx minutes-activefor:xx
- application will become inactive after xx minutes-inactivefor:xx
- application will become active after xx minutes-appexit
- terminates current running instance of application-appon
- makes the current running instance of the application active-appoff
- makes the current running instance of the application inactive-apptoggle
- toggles the running state of the current running instance of the application-apptoggleshowdlg
- toggles the running state, and shows dialog-replace
- closes the current running instance, replacing it-noicon
- does not show a task tray icon-useshift
- simulate the shift key instead of F15-allowss
- prevent sleep, but allow the screensaver to start-stes
- tell Windows to stay awake, don't use F15-showdlg
- shows a dialog indicating whether caffeine is active-ontaskbar
- show a task bar button (use with -showdlg)-key:xx
- simulate using virtual key code xx
Note: the codes on the linked page are in Hex, convert them to decimal for use with this parameter-keypress
- simulate a full key press, not just a key up event-oldicons
- use more colourful tray icons-lighticons
- always use the light icons-darkicons
- always use the dark icons-watchwindow:xx
- active only when a window with xx in the title is found-activehours:........xxxxxxxx........
- put 24 . or x characters - which indicate from hour 0 to hour 23 of the day. Caffeine will be active only in hours with an x-onac
- active only when the computer is on AC power (plugged in)-cpu:xx
- active until the CPU drops below xx%
Comparison of methods
Command line | Explanation |
empty | The F15 'key up' event is used every 59 seconds. This is the traditional behavior so is well tested, but can cause issues with Putty sessions, PowerPoint, Google Docs or Smartsheet |
-useshift | Instead of F15 , the shift key is used. This solves some of the issues with the above apps, but may cause the shift key to become "unpressed" sometimes |
-key:xx | Instead of F15 , the key specified by xx is used. Your choice of key could have side effects |
-keypress | This is more likely to cause side effects, as a full key down/key up is generated. It's included for compatibility with older systems which might need this |
-stes | Uses a different method (calling SetThreadExecutionState to tell Windows not to sleep. It works for me, with no side effects, but hasn't had enough testing for me to sure it's entirely better than using F15 . Note that this will keep the machine awake, but not simulate activity, meaning any app which tracks user input will not see any. |
-allowss | The same as -stes but this time the screensaver can start. Note that this will keep the machine awake, but not simulate activity, meaning any app which tracks user input will not see any. |
Videos
Caffeine user humancar2n has put together a short YouTube video showing how the app works.
@kbayodetroya has created a Spanish language video showing how the app works.
Mac version
Do you need this functionality on your Mac? Intelliscape Software have written a separate app, also named Caffeine, which can help you out.
Versions
v1.97 - April 2021
- Added
-lighticons
and-darkicons
to force one of those
v1.96 - March 2021
- Fixed a crash using
-exitafter:
- Added the
-onac
switch - Fixed the
-oldicons
which I broke in a previous release :(
v1.95 - February 2021
-darkicons
command line option removed (Caffeine now reads this from Windows)-stes
command line option added- The command line is now interpreted and shows in the tooltip. This means you can see what Caffine has recognised.
- The menu also follows Windows dark mode
v1.90 - October 2020
-darkicons
command line option added-activehours
command line option added- Tooltip replaced with a new one which works more reliably
- Menu appearance updated
v1.81 - May 2020
- Bug with the
-watchwindow
command line fixed
v1.80 - January 2020
v1.64 - September 2017
- Option for old icons added, 'cos not everyone likes the new ones
v1.63 - February 2017
- Icons updated slightly to show up better on a white background.
v1.62 - April 2016
- New icons, designed by Rubén Gómez Radioboy
v1.61 - October 2015
- Fixed bug with app not going active/inactive correctly when a timed period elapsed
v1.60 - July 2013
- New command line options:
-allowss
-ontaskbar
-apptoggleshowdlg
-key:xx
-keypress
- Added menu items to go Active/Inactive
- Type in About box corrected
-apptoggle
will re-show the dialog if it was originally shown
v1.50 - November 2010
- New command line options:
-inactivefor
-showdlg
-apptoggle
- Simulated keypress changed from right context menu key to F15 as this is likely to be even less intrusive.
Download Caffeine (x86 and x64)