Changed backlight widget
parent
17da29c03e
commit
079bef1e52
|
@ -1,53 +1,21 @@
|
||||||
local backlight = req_rel(..., "util")
|
local backlight = req_rel(..., "util")
|
||||||
local widget = {}
|
local widget = {}
|
||||||
|
local dotgrid = require("widgets.dotgrid")
|
||||||
|
|
||||||
|
widget.dots = dotgrid:new();
|
||||||
widget.icon = wibox.widget {
|
widget.dots.on_color = {0.18, 0.88, 1}
|
||||||
id = "icon",
|
widget.dots.off_color = {0.1, 0.44, 0.5}
|
||||||
image = beautiful.icons.brightness.i,
|
widget.dots.spacing = beautiful.dpi(2)
|
||||||
resize = true,
|
|
||||||
widget = wibox.widget.imagebox,
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.arc = wibox.widget {
|
|
||||||
{
|
|
||||||
widget.icon,
|
|
||||||
top = beautiful.dpi(1),
|
|
||||||
bottom = beautiful.dpi(1),
|
|
||||||
layout = wibox.container.margin,
|
|
||||||
},
|
|
||||||
max_value = 100,
|
|
||||||
thickness = beautiful.dpi(4),
|
|
||||||
start_angle = 4.71238898, -- 2pi*3/4
|
|
||||||
--forced_height = beautiful.dpi(16),
|
|
||||||
--forced_width = beautiful.dpi(16),
|
|
||||||
colors = {"#27D4CC", "#00446B"},
|
|
||||||
bg = "#FFFFFF30",
|
|
||||||
paddings = beautiful.dpi(2),
|
|
||||||
widget = wibox.container.arcchart
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
widget.widget = wibox.widget {
|
widget.widget = wibox.widget {
|
||||||
{
|
{
|
||||||
{ -- Right space
|
widget.dots,
|
||||||
widget = wibox.widget.separator,
|
|
||||||
color = beautiful.color.transparent,
|
|
||||||
forced_width = beautiful.dpi(3)
|
|
||||||
},
|
|
||||||
{ -- Main indicator. Can be replaced with widget.arc
|
|
||||||
widget.arc,
|
|
||||||
top = beautiful.dpi(2),
|
top = beautiful.dpi(2),
|
||||||
bottom = beautiful.dpi(2),
|
bottom = beautiful.dpi(2),
|
||||||
|
left = beautiful.dpi(2),
|
||||||
|
right = beautiful.dpi(2),
|
||||||
layout = wibox.container.margin,
|
layout = wibox.container.margin,
|
||||||
},
|
},
|
||||||
{ -- Left space
|
|
||||||
widget = wibox.widget.separator,
|
|
||||||
color = beautiful.color.transparent,
|
|
||||||
forced_width = beautiful.dpi(3)
|
|
||||||
},
|
|
||||||
layout = wibox.layout.align.horizontal,
|
|
||||||
},
|
|
||||||
layout = wibox.container.background,
|
layout = wibox.container.background,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,18 +45,8 @@ widget.widget:connect_signal("button::press",
|
||||||
|
|
||||||
awesome.connect_signal("module::backlight:update",
|
awesome.connect_signal("module::backlight:update",
|
||||||
function(value)
|
function(value)
|
||||||
widget.arc.value = value
|
widget.dots.value = value
|
||||||
|
widget.dots:emit_signal("widget::redraw_needed")
|
||||||
if value >= 90 then widget.icon.image = beautiful.icons.brightness.i
|
|
||||||
elseif value >= 80 then widget.icon.image = beautiful.icons.brightness.h
|
|
||||||
elseif value >= 70 then widget.icon.image = beautiful.icons.brightness.g
|
|
||||||
elseif value >= 60 then widget.icon.image = beautiful.icons.brightness.f
|
|
||||||
elseif value >= 50 then widget.icon.image = beautiful.icons.brightness.e
|
|
||||||
elseif value >= 40 then widget.icon.image = beautiful.icons.brightness.d
|
|
||||||
elseif value >= 30 then widget.icon.image = beautiful.icons.brightness.c
|
|
||||||
elseif value >= 20 then widget.icon.image = beautiful.icons.brightness.b
|
|
||||||
elseif value <= 10 then widget.icon.image = beautiful.icons.brightness.a end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue