Created
January 5, 2020 08:43
-
-
Save ufo22940268/97ef2259d291b37b08c07a524b6bb1a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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