我需要帮助将我的3.5 rc.lua移植到4.0。我尝试设置一个进度条。
过去是:
mybacklight = awful.widget.progressbar()
mybacklight:set_width(12)
mybacklight:set_height(10)
mybacklight:set_vertical(true)
mybacklight:set_background_color("#131211")
mybacklight:set_border_color(nil)
新版本应为:
mybacklight = wibox.widget.progressbar {
max_value = 1,
value = brightness_new,
forced_width = 12,
forced_height = 10,
background_color = "#131211",
border_color = nil,
color = {type="linear", from = {0, 0}, to = {0, 20},
stops = { {0, "#F6F6F6"}, {0.5,
"#bdbdbd"}, {1.0, "#3b3b3b"} } },
widget = wibox.widget.progressbar,
direction = 'east',
layout = wibox.container.rotate
}
3.5版本可以工作(没有错误),但不再给出预期的结果,它应该是一个垂直的进度条,它是,但是进展本身是水平的。
4.0版本没有错误,除了它采用红色(默认?)颜色的所有地方。
答案 0 :(得分:0)
首先,命令式语法没有消失,你仍然可以“旧方式”。它完全受支持,声明性的“编译”为旧的。
现在,要回答这个问题,代码看起来应该是(未经测试的):
mybacklight = wibox.widget {
{
max_value = 1,
value = brightness_new,
background_color = "#131211",
color = {type="linear", from = {0, 0}, to = {0, 20},
stops = { {0, "#F6F6F6"}, {0.5,
"#bdbdbd"}, {1.0, "#3b3b3b"} }
},
widget = wibox.widget.progressbar,
},
forced_width = 12,
forced_height = 10,
direction = 'east',
layout = wibox.container.rotate
}
的变化:
wibox.widget
。您使用progressbar
构造函数构建了rotate
容器参考https://awesomewm.org/apidoc/classes/wibox.widget.progressbar.html#