awful.rules: Allow specifying tags by name

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-10 11:15:21 +02:00 committed by Uli Schlachter
parent 7d5e80a8ee
commit 9cc28a8da5
1 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,7 @@ local table = table
local type = type local type = type
local ipairs = ipairs local ipairs = ipairs
local pairs = pairs local pairs = pairs
local atag = require("awful.tag")
local rules = {} local rules = {}
@ -36,6 +37,11 @@ If you want to put Firefox on a specific tag at startup, you can add:
{ rule = { instance = "firefox" }, { rule = { instance = "firefox" },
properties = { tag = mytagobject } } properties = { tag = mytagobject } }
Alternatively, you can specify the tag by name:
{ rule = { instance = "firefox" },
properties = { tag = "3" } }
If you want to put Thunderbird on a specific screen at startup, use: If you want to put Thunderbird on a specific screen at startup, use:
{ rule = { instance = "Thunderbird" }, { rule = { instance = "Thunderbird" },
@ -213,8 +219,12 @@ function rules.execute(c, props, callbacks)
-- Support specifying screens by name ("VGA1") -- Support specifying screens by name ("VGA1")
c.screen = screen[value] c.screen = screen[value]
elseif property == "tag" then elseif property == "tag" then
c.screen = value.screen local t = value
c:tags({ value }) if type(t) == "string" then
t = atag.find_by_name(props.screen, t)
end
c.screen = t.screen
c:tags({ t })
elseif property == "switchtotag" and value and props.tag then elseif property == "switchtotag" and value and props.tag then
props.tag:view_only() props.tag:view_only()
elseif property == "height" or property == "width" or elseif property == "height" or property == "width" or