Last active
February 15, 2017 19:47
-
-
Save jellea/9a78bb00856d1d6077dcaf2bacb7d651 to your computer and use it in GitHub Desktop.
Go to bed! Fade out computer screen from 22:00 to 23:00. Hammerspoon
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
function brightnessDown () | |
lct = hs.timer.localTime() | |
tt = 60*60*22 -- 22:00 | |
if lct > tt then | |
wish = 100-math.ceil((lct % tt) / (60*60) * 100) -- time after | |
if hs.brightness.get() > wish then | |
hs.brightness.set(wish) | |
end | |
end | |
end | |
-- run every minute | |
brtimer = hs.timer.doEvery(60, brightnessDown) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment