docs » Caffeine

Prevent the screen from going to sleep Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Caffeine.spoon.zip

API Overview

API Documentation

Methods

bindHotkeys
Signature Caffeine:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for Caffeine

Parameters
  • mapping - A table containing hotkey modifier/key details for the following items:
    • toggle - This will toggle the state of display sleep prevention, and update the menubar graphic
Returns
  • The Caffeine object
Source Source/Caffeine.spoon/init.lua line 32
setState
Signature Caffeine:setState(on)
Type Method
Description

Sets whether or not caffeination should be enabled

Parameters
  • on - A boolean, true if screens should be kept awake, false to let macOS send them to sleep
Returns
  • None
Source Source/Caffeine.spoon/init.lua line 105
start
Signature Caffeine:start()
Type Method
Description

Starts Caffeine

Parameters
  • None
Returns
  • The Caffeine object
Source Source/Caffeine.spoon/init.lua line 53
stop
Signature Caffeine:stop()
Type Method
Description

Stops Caffeine

Parameters
  • None
Returns
  • The Caffeine object
Source Source/Caffeine.spoon/init.lua line 74