rules: add a switchtotag rule to select the tag after setting it for a client

Signed-off-by: Cedric GESTES <ctaf42@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Cedric GESTES 2009-08-27 12:43:00 +02:00 committed by Julien Danjou
parent a6c4459a3a
commit ddc159f57e
1 changed files with 18 additions and 3 deletions

View File

@ -10,6 +10,7 @@ local type = type
local ipairs = ipairs local ipairs = ipairs
local pairs = pairs local pairs = pairs
local aclient = require("awful.client") local aclient = require("awful.client")
local atag = require("awful.tag")
--- Apply rules to clients at startup. --- Apply rules to clients at startup.
module("awful.rules") module("awful.rules")
@ -24,17 +25,28 @@ module("awful.rules")
-- </code> -- </code>
-- </p> -- </p>
-- <p>If you want to set mplayer floating at startup, you can add: -- <p>If you want to set mplayer floating at startup, you can add:
-- <code>
-- <br/> -- <br/>
-- <code>
-- { rule = { name = "MPlayer" }, -- { rule = { name = "MPlayer" },
-- properties = { floating = true } } -- properties = { floating = true } }
-- </code> -- </code>
-- </p> -- </p>
-- <p>If you want to put Firefox on a specific tag at startup, you -- <p>If you want to put Firefox on a specific tag at startup, you
-- can add: -- can add:
-- <code -- <br/>
-- { rule = { instance = "Firefox" } -- <code>
-- { rule = { instance = "firefox" }
-- properties = { tag = mytagobject } } -- properties = { tag = mytagobject } }
-- </code>
-- </p>
-- <p>If you want to put Emacs on a specific tag at startup, and
-- immediately switch to that tag you can add:
-- <br/>
-- <code>
-- { rule = { class = "Emacs" }
-- properties = { tag = mytagobject, switchtotag = true } }
-- </code>
-- </p>
-- <p>Note that all "rule" entries need to match. If any of the entry does not -- <p>Note that all "rule" entries need to match. If any of the entry does not
-- match, the rule won't be applied.</p> -- match, the rule won't be applied.</p>
-- <p>If a client matches multiple rules, their applied in the order they are -- <p>If a client matches multiple rules, their applied in the order they are
@ -74,6 +86,9 @@ function apply(c)
aclient.floating.set(c, value) aclient.floating.set(c, value)
elseif property == "tag" then elseif property == "tag" then
aclient.movetotag(value, c) aclient.movetotag(value, c)
elseif property == "switchtotag" and value
and entry.properties["tag"] then
atag.viewonly(entry.properties["tag"])
elseif type(c[property]) == "function" then elseif type(c[property]) == "function" then
c[property](c, value) c[property](c, value)
else else