我认为可能的方法之一是在主题更改后重新创建所有小部件。不知道整个代码,但这里是快速的例子,如何通过hotkey重建面板为真棒v4.0。
一些修改为第一
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)
屏幕构建功能并添加动作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"}
),
,另外修复了客户端等边框颜色... –