在 awm 中使用标签自动启动应用程序

在 awm 中使用标签自动启动应用程序

在尝试使用 awm 时我遇到了一些问题。我想在 awm 使用特定标签启动时自动启动一些应用程序。这是我为此使用的相关配置。

首先是我的带有布局的标签:

tags = {
    names = {"mail", "www", "video", "files", 5, 6, 7, 8, 9},
    layout = {layouts[11], layouts[11], layouts[11], layouts[11], layouts[1],      layouts[1], layouts[1], layouts[1], layouts[1]}
}

for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag(tags.names, s, tags.layout)
end

现在是应用程序自动启动的内容:

awful.util.spawn("chromium-browser")
awful.util.spawn("firefox")
awful.util.spawn("vlc")
awful.util.spawn_with_shell("xterm -name files -e mc")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xfce4-power-manager")

我使用带有 -name 参数的 xterm 为它们提供自定义类(通过规则自定义标签)。
现在有一些规则将应用程序与标签连接起来:

awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
  properties = { border_width = beautiful.border_width,
                 border_color = beautiful.border_normal,
                 focus = true,
                 keys = clientkeys,
                 buttons = clientbuttons } },
{ rule = { class = "MPlayer" },
  properties = { floating = true } },
{ rule = { class = "pinentry" },
  properties = { floating = true } },
{ rule = { class = "gimp" },
  properties = { floating = true } },
-- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" },
--   properties = { tag = tags[1][2] } },

    { rule = { class = "Firefox" },
            properties = { tag = tags[1][2] } },
    { rule = { class = "Chromium-browser" },
            properties = { tag = tags[1][1] } },
    { rule = { class = "Vlc"},
            properties = { tag = tags[1][3] } },
    { rule = { class = "files"},
            properties = { tag = tags[1][4] } },
    { rule = { class = "5term"},
            properties = { tag = tags[1][5] } },
 }

它适用于 chromium、firefox 和 vlc,但不适用于带有“-name”参数的 xterms。当我使用 xprop 启动 xterms 后检查它们时,我可以看到:

WM_CLASS(STRING) = "5term", "XTerm"

我认为那应该可行,但是 xterm 被放置在第一个工作区/标签上。

答案1

你想要的是instance = "5term",而不是class = "5term"。WM_CLASS(String) 中的第一个术语是实例,而不是类。

相关内容