如何为每个标签列表项设置不同的背景颜色?我知道我必须使用 widget_template
但我不知道如何使用,我使用的是 AwesomeWM 4.3
最佳答案
假设您有以此颜色表的键命名的标签:
colors = {
term = "#FF0000",
www = "#00FF00",
divers = "#0000FF",
travail = "#FF0000",
default = "#00FF00"
}
也许还有其他一些。
使用 widget_template
(您已引用),在 awful.widget.taglist
内:
widget_template = {
{
id = 'text_role',
widget = wibox.widget.textbox
},
id = 'bg',
widget = wibox.container.background,
create_callback = function(self, t, index, tagsList)
self.bg = colors[t.name] or colors.default
end,
}
另请参阅:documentation
关于lua - 每个标签列表项都有不同的背景颜色 AwesomeWM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62802727/