超棒窗口管理器 - 将程序分配给标签的规则

超棒窗口管理器 - 将程序分配给标签的规则

我有一组标签“main”、“www”和 3:

-- {{{ Tags
tags = {
    names = {"main", "www", 3},
    for s = 1, screen.count() do
       tags[s] = awful.tag(tags.names, s, tags.layout)
    end
}
-- }}}

我想要 Firefox 在标签“www”中打开。我尝试了以下规则:

-- {{{ Rules
awful.rules.rules = {
    { rule = {class = "Firefox" },
      properties = { tag = tags[1]["www"] }},
}
-- }}}

但是,如果我按下 Super+R 然后输入“firefox”或者从终端运行“firefox &”,Firefox 就会在我正在查看的任何标签中打开。

我尝试过{class = "firefox"}properties = { tag = tags[1][2] }但是那些修改后的规则也不起作用。

设置规则以使 Firefox 始终在特定标签中打开的正确方法是什么?

答案1

我只是将我的摘录粘贴在这里。这些已确认在 3.4.10+ 版本中有效。

...
 62 -- {{{ Tags
 63 -- Define a tag table which will hold all screen tags.
 64 tags = {                                                                                                                                                                                      
 65     names  = { "1www", "2 @ ", "3trm", "4off", "5msg", "6vmr", 7, "8tom", "9log" },
 66     layout = { layouts[1], layouts[2], layouts[3], layouts[2], layouts[3],
 67                layouts[3], layouts[3], layouts[3], layouts[3] }
 68 }
 69 for s = 1, screen.count() do
 70     -- Each screen has its own tag table.
 71     tags[s] = awful.tag(tags.names, s, tags.layout)
 72 end
 73 -- }}}
...
408 -- {{{ Rules
409 awful.rules.rules = {
410     -- All clients will match this rule.
411     { rule = { },
412       properties = { border_width = beautiful.border_width,
413                      border_color = beautiful.border_normal,
414                      focus = true,
415                      keys = clientkeys,
416                      buttons = clientbuttons } },
417     -- Set Firefox to always map on tags number 1 of screen 1.
418     { rule = { class = "Firefox" },
419        properties = { tag = tags[1][1] } },
420     { rule = { class = "Gvim" },
421       properties = { size_hints_honor = false } },
422     { rule = { class = "KeePass.exe" },
423        properties = { maximized_vertical = true, maximized_horizontal = true } },
424     { rule = { class = "Mirage" },
425        properties = { maximized_vertical = true, maximized_horizontal = true } },
426     { rule = { class = "Navigator" },
427        properties = { tag = tags[1][1], maximized_vertical = true, maximized_horizontal = true } },
428     { rule = { class = "pinentry" },
429       properties = { floating = true } },
430     { rule = { class = "Skype" },
431       properties = { tag = tags[1][5] } },
432     { rule = { class = "Thunderbird" },
433        properties = { tag = tags[1][2] } },
434     { rule = { class = "Tomboy" },
435        properties = { tag = tags[1][8] } },
436     { rule = { class = "URxvt" },
437       properties = { size_hints_honor = false } },
438     { rule = { class = "Vncviewer" },
439        properties = { maximized_vertical = true, maximized_horizontal = true } },
440     { rule = { class = "XMind" },
441        properties = { maximized_vertical = true, maximized_horizontal = true } },
442     { rule = { class = "XTerm" },
443       properties = { size_hints_honor = false } },
444     { rule = { instance = "XTerm-logs" },
445        properties = { tag = tags[1][9] } },
446 }
447 -- }}}

我不知道 Lua 如何处理空格,我确实注意到你的花括号和空格不一致。

答案2

这有点推测,但我建议重新尝试你所说的话 :{class = "firefox"}但是properties = { tag = tags[1][2] }大写的首字母firefox。这很重要。

答案3

标签数组由数字索引。

properties = { tag = tags[1]["www"] }},

所以应该是:

properties = { tag = tags[1][2] }},

相关内容