diff --git a/lib/wibox/widget/background.lua.in b/lib/wibox/widget/background.lua.in index 12fa9b1e8..ad95e8b0d 100644 --- a/lib/wibox/widget/background.lua.in +++ b/lib/wibox/widget/background.lua.in @@ -34,7 +34,14 @@ function draw(box, wibox, cr, width, height) cr:restore() + if box.foreground then + cr:save() + cr:set_source(box.foreground) + end layout_base.draw_widget(wibox, cr, box.widget, 0, 0, width, height) + if box.foreground then + cr:restore() + end end --- Fit this widget into the given area @@ -69,6 +76,16 @@ function set_bg(box, bg) box._emit_updated() end +--- Set the foreground to use +function set_fg(box, fg) + if fg then + box.foreground = color(fg) + else + box.foreground = nil + end + box._emit_updated() +end + --- Set the background image to use function set_bgimage(box, image) local image = image