1234567891011121314151617181920 |
- local wibox = require("wibox")
- local awful = require("awful")
- light_widget = wibox.widget.textbox()
- light_widget:set_align("center")
- function update_light(widget)
- local cmd = "brightnessctl i | awk '{if ($1 == \"Current\"){print substr($4, 2, length($4) - 2)}}'"
- local fd = io.popen(cmd)
- local status = fd:read("*l")
- fd:close()
- widget:set_markup("L: "..status)
- end
- update_light(light_widget)
- mytimer = timer({ timeout = 1 })
- mytimer:connect_signal("timeout", function () update_light(light_widget) end)
- mytimer:start()
|