使用layout.fixed时的中心位置任务列表

时间:2017-12-16 15:43:23

标签: awesome-wm

我在顶栏使用以下设置:

  -- 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
    },
  }

这会导致: enter image description here

我已禁用任务的名称。我想要完成的是 将任务列表的图标显示在中心。如何实现这一点,同时保留左侧的标签和系统托盘 在右边?

修改

在应用 expand = outside 时,我会收到以下信息:

enter image description here

EDIT2

当我添加这些容器设置时:

-- 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"})

我明白了:

enter image description here

哪个好一点,但仍未完全居中。

1 个答案:

答案 0 :(得分:2)

我通过应用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中完美地对齐了以下栏:

enter image description here