I think one of possible ways is recreate all you widgets after theme changes. Not sure for whole code, but here is quick example how to rebuild panel by hotkey for awesome v4.0.
Some modifications for screen building functions first
local function build_panel(s)
-- destroy old panel
if s.mywibox then s.mywibox:remove() end
-- create a promptbox for given screen
s.mypromptbox = awful.widget.prompt()
-- create a layoutbox for given screen
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end))
)
-- create a taglist widget
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
-- create a tasklist widget
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
-- create panel wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
-- add widgets to the panel wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ layout = wibox.layout.fixed.horizontal, mylauncher, s.mytaglist, s.mypromptbox },
s.mytasklist,
{ layout = wibox.layout.fixed.horizontal, mykeyboardlayout, wibox.widget.systray(), mytextclock, s.mylayoutbox },
}
end
awful.screen.connect_for_each_screen(function(s)
-- wallpaper
set_wallpaper(s)
-- tags
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
-- panel setup
build_panel(s)
end)
And add action to globalkeys
awful.key(
{ modkey }, "z",
function()
-- change theme settings
beautiful.bg_normal = "#ff2020"
beautiful.fg_normal = "#2020ff"
-- rebuild panel widgets
build_panel(mouse.screen)
end,
{description="theme colors change", group="awesome"}
),