aboutsummaryrefslogtreecommitdiff
path: root/.config/luastatus-scripts-dwm/backlight.lua
blob: 3fa1818d710062432c5feb566be3d8ae24665766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- Note that this widget only shows backlight level when it changes.
widget = luastatus.require_plugin('backlight-linux').widget{
    cb = function(level)
        if level ~= nil then
            local brightness = level * 100

            local icon = "󰃠"
            if brightness < 30 then
              icon = "󰃞"
            elseif brightness < 70 then
              icon = "󰃟"
            end

            io.write(level * 100)
            return string.format('%s %3.0f%%', icon, brightness)
        end
    end,
}