我对顶部栏使用以下设置:
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- 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 the wibox
s.mywibox = awful.wibar({ position = theme.position, screen = s, height = theme.height })
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{
-- Left widgets
layout = wibox.layout.fixed.horizontal,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{
-- Right widgets
layout = wibox.layout.fixed.horizontal,
theme.systray,
theme.spr_left,
theme.volume,
theme.battery,
theme.clock,
theme.spr_right
},
}
我已经禁用了任务的名称。我想要完成的是 在中心显示任务列表的图标。我怎样才能做到这一点,同时保留左侧的标签和系统托盘 在右侧?
编辑
应用 expand = outside 时,我得到以下结果:
编辑2
当我添加这些容器设置时:
-- Tasklist container
local tl = wibox.container.background(s.mytasklist, theme.bg_normal, gears.shape.rectangle)
local pl = wibox.container.margin(tl, 2, 2, 3, 3)
local tasklist = wibox.container.place(pl, {halign="center"})
我得到:
哪个好一点,但仍然没有完全居中。
最佳答案
我通过对水平对齐应用 expand = "none"解决了这个问题。如下:
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
expand = "none",
{
-- Left widgets
layout = wibox.layout.fixed.horizontal,
s.mytaglist,
s.mypromptbox,
},
-- Middle widget
s.mytasklist,
{
-- Right widgets
layout = wibox.layout.fixed.horizontal,
theme.systray,
theme.spr_left,
theme.volume,
theme.battery,
theme.clock,
theme.spr_right
},
}
end)
在 Awesome v4.2-257-g59aa4ac7 上完美对齐条形图如下:
关于awesome-wm - 使用 layout.fixed 时居中位置任务列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47847305/