Skip to content

Instantly share code, notes, and snippets.

@Phyks
Last active August 29, 2015 13:57
Show Gist options
  • Save Phyks/9539855 to your computer and use it in GitHub Desktop.
Save Phyks/9539855 to your computer and use it in GitHub Desktop.
local wibox = require("wibox")
local awful = require("awful")
brightness_widget = wibox.widget.textbox()
brightness_widget:set_align("right")
function round(num, idp)
return tonumber(string.format("%." .. (idp or 0) .. "f", num))
end
function update_brightness(widget)
local brightness = round(tonumber(awful.util.pread("xbacklight -get")) or 0, 0)
brightness = " Brightness : " .. brightness .. "%" .. " |"
widget:set_markup(brightness)
end
update_brightness(brightness_widget)
-- Brightness control display
local brightness = require("brightness")
right_layout:add(brightness_widget)
awful.key({ }, "XF86MonBrightnessUp", function() update_brightness(brightness_widget) end),
awful.key({ }, "XF86MonBrightnessDown", function() update_brightness(brightness_widget) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment