awesome-wm - 使用 layout.fixed 时居中位置任务列表

标签 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

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

我得到:

enter image description here

哪个好一点,但仍然没有完全居中。

最佳答案

我通过对水平对齐应用 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

关于awesome-wm - 使用 layout.fixed 时居中位置任务列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47847305/

相关文章:

linux - Eclipse 打字速度慢

awesome-wm - Awesome 中的不同布局是如何工作的?

lua - awesome wm 登录时崩溃

linux - 如何在很棒的 WM 上使用快捷方式运行 bash

linux - Picom 内核模糊

youtube - 在 Awesome 3.5 中最大化 youtube 视频时如何删除标题栏?

lua - 很棒的 wm/恶意小部件 : using a format function throws a bad argument error

layout - 很棒的 WM : Rearrange windows without changing layout

awesome-wm - 真棒 WM : automatically display client across two monitors

lua - 为什么需要在很棒的 wm 模块中重新定义标准变量?