delta
f42a3a2cc9
add new icons, switch over to using stylesheets instead of gears.color.recolor_image, add a music widget to the panel, optimize services in common.lua, fix the application lense filtering and increase the update rate of services in common.lua Signed-off-by: delta <darkussdelta@gmail.com>
83 lines
3.3 KiB
Lua
83 lines
3.3 KiB
Lua
local phosphor = require "assets.phosphor"
|
|
local qmath = require "quarrel.math"
|
|
local qui = require "quarrel.ui"
|
|
local qvars = require "quarrel.vars"
|
|
local wibox = require "wibox"
|
|
|
|
local function create_display(icon, color)
|
|
return wibox.widget(qui.styled {
|
|
widget = wibox.container.background,
|
|
{
|
|
widget = wibox.container.margin,
|
|
margins = qvars.big_padding,
|
|
{
|
|
widget = wibox.container.place,
|
|
{
|
|
{
|
|
widget = wibox.container.radialprogressbar,
|
|
max_value = 100,
|
|
border_color = qvars.colors.black,
|
|
color = color,
|
|
border_width = qvars.border_width * 2,
|
|
forced_height = qvars.element_size * 4,
|
|
forced_width = qvars.element_size * 4,
|
|
{
|
|
widget = wibox.container.place,
|
|
qui.icon(icon, color, { id = "icon" })
|
|
},
|
|
id = "indicator"
|
|
},
|
|
{
|
|
widget = wibox.container.place,
|
|
{
|
|
widget = wibox.widget.textbox,
|
|
text = "0%",
|
|
id = "text"
|
|
}
|
|
},
|
|
layout = wibox.layout.fixed.vertical,
|
|
spacing = qvars.big_padding
|
|
}
|
|
}
|
|
}
|
|
})
|
|
end
|
|
|
|
local d_audio = create_display(phosphor.speaker_simple_high_fill, qvars.colors.fg)
|
|
awesome.connect_signal("services::audio", function(volume)
|
|
if not volume then
|
|
return
|
|
end
|
|
d_audio:get_children_by_id("indicator")[1].value = math.min(volume, 100)
|
|
d_audio:get_children_by_id("text")[1].text = volume .. "%"
|
|
end)
|
|
awesome.connect_signal("services::audio::icon", function(icon, color)
|
|
d_audio:get_children_by_id("indicator")[1].color = color
|
|
d_audio:get_children_by_id("icon")[1].image = icon
|
|
d_audio:get_children_by_id("icon")[1].stylesheet = qui.recolor(color)
|
|
end)
|
|
|
|
local d_battery = create_display(phosphor.battery_vertical_warning_fill, qvars.colors.red)
|
|
awesome.connect_signal("services::battery", function(capacity)
|
|
d_battery:get_children_by_id("indicator")[1].value = capacity
|
|
d_battery:get_children_by_id("text")[1].text = capacity .. "%"
|
|
end)
|
|
awesome.connect_signal("services::battery::icon", function(icon, color)
|
|
d_battery:get_children_by_id("indicator")[1].color = color
|
|
d_battery:get_children_by_id("icon")[1].image = icon
|
|
d_battery:get_children_by_id("icon")[1].stylesheet = qui.recolor(color)
|
|
end)
|
|
|
|
local d_brightness = create_display(phosphor.sun_fill, qvars.colors.fg)
|
|
awesome.connect_signal("services::brightness", function(brightness)
|
|
brightness = math.floor(qmath.translate_range(brightness, 0, 255, 0, 100))
|
|
d_brightness:get_children_by_id("indicator")[1].value = brightness
|
|
d_brightness:get_children_by_id("text")[1].text = brightness .. "%"
|
|
end)
|
|
awesome.connect_signal("services::brightness::icon", function(icon, color)
|
|
d_brightness:get_children_by_id("icon")[1].image = icon
|
|
d_brightness:get_children_by_id("icon")[1].stylesheet = qui.recolor(color)
|
|
end)
|
|
|
|
return { audio = d_audio, battery = d_battery, brightness = d_brightness }
|