Skip to content

Instantly share code, notes, and snippets.

@ufo22940268
Created January 5, 2020 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufo22940268/97ef2259d291b37b08c07a524b6bb1a5 to your computer and use it in GitHub Desktop.
Save ufo22940268/97ef2259d291b37b08c07a524b6bb1a5 to your computer and use it in GitHub Desktop.
local brightness = 50
function onAwake(eventType)
if eventType == hs.caffeinate.watcher.systemDidWake or eventType == hs.caffeinate.watcher.screensDidUnlock then
print("awake----------")
hs.brightness.set(brightness)
elseif eventType == hs.caffeinate.watcher.screensDidSleep then
print("screensDidSleep----------")
brightness = hs.brightness.get()
end
end
local watcher = hs.caffeinate.watcher.new(onAwake)
watcher:start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment