2

I have a set of tags 'main', 'www', and 3:

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

I want Firefox to open in tag "www". I've tried the following rule:

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

However, if I hit Super+R then type 'firefox' or run 'firefox &' from a terminal, Firefox opens in whatever tag I'm viewing.

I've tried {class = "firefox"} and properties = { tag = tags[1][2] } but those modified rules did not work either.

What is the correct way to set up a rule to make firefox always open in a particular tag?

  • Did you restart awesome to make sure the config changes are applied ? If yes, then I suspect something like "the rules are applied when the client first exists, but it doesn't have this class yet". You can check that the rules are applied when you restart awesome (with the firefox window open on the wrong tag, it should move to the right one). If so, it's not a match problem, and you should seek to awful.rules.apply() to your firefox client at some point after it's creation. If the rule is not applied, then there's a problem with the matcher. See superuser.com/q/513707/162290 – Nikana Reklawyks Jan 23 '17 at 5:59
3

I'm just going to paste my excerpts here. These are confirmed working as of 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 -- }}}

I have no idea how Lua deals with whitespace, I do notice your curly braces and whitespaces are inconsistent.

| improve this answer | |
  • 1
    Lua is almost as agnostic as C to whitespace. If brackets match, it's happy. – Anko Feb 27 '13 at 13:49
2

This is a bit speculative but I suggest retrying what you say you did: {class = "firefox"} and properties = { tag = tags[1][2] } but capitalize the first letter of firefox. It matters.

| improve this answer | |
1

tag array is indexed by numerals.

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

So should be:

properties = { tag = tags[1][2] }},
| improve this answer | |
  • And that's probably not the only problem, but on my setup, this is correct. – Nikana Reklawyks Jan 23 '17 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.