Skip to content

Instantly share code, notes, and snippets.

@jellea
Last active February 15, 2017 19:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jellea/9a78bb00856d1d6077dcaf2bacb7d651 to your computer and use it in GitHub Desktop.
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
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