0

我正在尝试为 AwesomeWM 编辑我的.config/awesome/theme.lua.config/theme/rc.lua文件。我在theme.lua文件中有以下几行:

theme.border_width = dpi(5)
theme.border_normal = "#14ff1b"
theme.border_focus = "#00158f"

效果很好 - 非活动窗口上的浅绿色边框和活动窗口上的蓝色边框。问题是我也在运行 polybar(在删除rc.lua默认栏的行之后)并像这样启动它rc.lua(当我从.xinitrcAwesomeWM 重新加载后启动它时它不合适):

awful.spawn.with_shell("killall -q polybar") -- necesarry for a reload
awful.spawn.with_shell("polybar mybar") -- mybar is the name of the bar in `.config/polybar/config`

这永久地给了我一个令人讨厌的多边形周围的绿色边框,我的问题是我想删除它。我试着把它放在rc.lua上述几行之前:

ruled.client.append_rule {
    rule = { class = "polybar" },
    properties = { client.border_width = 0 }
}

但这不起作用。我查看了 Reddit 和 AwesomeWM 文档,但这是我能想到的最好的,但它不起作用。有谁知道我怎么能做到这一点,如果我能做到这一点(从 Polybar 中移除令人讨厌的 5dp 边框,同时基本上将其保留在其他所有东西上)。

另外,我尝试将其更改为client.border_width = xresources.apply_dpi(0),因为默认theme.lua文件设置dpi()xresources.apply_dpi()并将边框宽度设置为dpi(2)(我将其更改为 5),但这也不起作用。

更新 1:我在 reddit 上发布了这个,在回复和阅读更多文档之后,我写了这个,但仍然不起作用:

{ rule = { class = "Polybar" },
    properties = { border_width = 0 } }

我尝试用“instance”和“name”替换“class”(不确定区别是什么),我尝试同时使用大写的“Polybar”和小写的“polybar”,但这些都不起作用。

4

2 回答 2

0

在你的 rc.lua 中尝试这样的东西,它对我有用

ruled.client.connect_signal("request::rules", function()
    ...
    ...
    ruled.client.append_rule {
        id = "Polybar",
        rule_any = {
            class = {"Ploybar"}
        },
        properties = {
            border_width = 0,
        }
    }
    ...
    ...
}
于 2021-08-17T16:17:54.937 回答
0

好的,所以我想通了。我在 reddit 上发帖询问,从中得到了两条有用的信息:

  • 由于我不使用每晚,我不能使用规则。,而必须使用whole.rules。
  • “Polybar”可能会起作用,而“polybar”可能不会。

所以对于解决方案:

在 中的某一时刻rc.lua,您会得到以下信息:

awful.rules.rules = {
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     focus = awful.client.focus.filter,
                     raise = true,
                     keys = clientkeys,
                     buttons = clientbuttons,
                     screen = awful.screen.preferred,
                     placement = awful.placement.no_overlap+awful.placement.no_offscreen
      }
    }
    ...

因此,这为所有应用程序设置了一堆东西。然后我注释掉了这一行的这一部分:

      properties = { -- border_width = beautiful.border_width,

然后删除了边框宽度,因此也删除了边框。然后我在下面添加了一个单独的部分,它将边框宽度添加到除 polybar 之外的所有内容:

    { rule = { },
      except_any = { class = { "Polybar" } },
      properties = { border_width = beautiful.border_width }
    },

如果我以后想从其他任何东西中删除边框,我可以这样做:

except_any = { class = { "Polybar", "OtherApp1", "OtherApp2", "OtherApp3" } },
于 2021-08-22T14:12:41.323 回答