Set textclock markup directly instead of through update functions

This commit is contained in:
elenapan 2020-07-25 17:36:03 +03:00
parent 4493396bc7
commit 57e1087787
2 changed files with 4 additions and 26 deletions

View file

@ -142,14 +142,10 @@ local hours = wibox.widget.textclock("%H ")
hours.font = "sans bold 30"
hours.align = "center"
hours.valign = "center"
local minutes = wibox.widget.textclock(" %M")
local minutes = wibox.widget.textclock("<span foreground='" .. x.color14 .."'> %M</span>")
minutes.font = "sans 30"
minutes.align = "center"
minutes.valign = "center"
minutes.markup = "<span foreground='" .. x.color14 .."'>" .. minutes.text .. "</span>"
minutes:connect_signal("widget::redraw_needed", function ()
minutes.markup = "<span foreground='" .. x.color14 .."'>" .. minutes.text .. "</span>"
end)
-- Time
local time = wibox.widget {
@ -167,23 +163,13 @@ day_of_the_week.align = "center"
day_of_the_week.valign = "center"
day_of_the_week.align = "center"
day_of_the_week.valign = "center"
-- day_of_the_week.markup = "<span foreground='" .. x.color7 .."'>" .. day_of_the_week.text .. "</span>"
-- day_of_the_week:connect_signal("widget::redraw_needed", function ()
-- day_of_the_week.markup = "<span foreground='" .. x.color7 .."'>" .. day_of_the_week.text .. "</span>"
-- end)
local day_of_the_month = wibox.widget.textclock("%d")
local day_of_the_month = wibox.widget.textclock("<span foreground='" .. x.color1 .."'>%d</span>")
day_of_the_month.font = "sans bold 30"
day_of_the_month.fg = x.color0
day_of_the_month.align = "center"
day_of_the_month.valign = "center"
day_of_the_month.align = "center"
day_of_the_month.valign = "center"
day_of_the_month.markup = "<span foreground='" .. x.color1 .."'>" .. day_of_the_month.text .. "</span>"
day_of_the_month:connect_signal("widget::redraw_needed", function ()
day_of_the_month.markup = "<span foreground='" .. x.color1 .."'>" .. day_of_the_month.text .. "</span>"
end)
local date = wibox.widget {
day_of_the_week,
day_of_the_month,

View file

@ -62,17 +62,9 @@ local day_of_the_week = wibox.widget {
forced_width = dpi(1000),
align = "center",
valign = "center",
widget = wibox.widget.textclock("%A")
widget = wibox.widget.textclock(helpers.colorize_text("%A", x.color3))
}
local function update_dotw()
day_of_the_week.markup = helpers.colorize_text(day_of_the_week.text, x.color3)
end
update_dotw()
day_of_the_week:connect_signal("widget::redraw_needed", function ()
update_dotw()
end)
local month = wibox.widget {
font = "San Francisco Display Heavy 100",
align = "center",