Last active
August 29, 2015 13:57
-
-
Save Phyks/9539855 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 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) |
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
-- 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