Skip to content

Instantly share code, notes, and snippets.

@josefnpat
Last active October 31, 2015 17:46
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 josefnpat/b813b8ed089f47f37753 to your computer and use it in GitHub Desktop.
Save josefnpat/b813b8ed089f47f37753 to your computer and use it in GitHub Desktop.
Simple screen brightness app that leverages xbacklight
function love.conf(t)
t.version = "0.9.2"
t.window.title = "Screen Brightness"
t.window.width = 400
t.window.height = 32
end
local temp_file = "xbacklight"
function love.load()
love.filesystem.write(temp_file,"0")
os.execute("xbacklight > \""..love.filesystem.getSaveDirectory().."\"/"..
temp_file)
current = love.filesystem.read(temp_file)/100 or 0
end
function love.draw()
love.graphics.rectangle("fill",0,0,
current*love.graphics.getWidth(),
love.graphics.getHeight())
end
function love.mousepressed(x,y,button)
current = x/love.graphics.getWidth()
os.execute("xbacklight -set "..math.floor(current*100))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment