From af5037104c093b7ff3cc93f2cd23d758086ea852 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 24 Aug 2009 16:43:00 +0200 Subject: [PATCH] awful.rules: document matching, support non-string rules Signed-off-by: Julien Danjou --- lib/awful/rules.lua.in | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in index 341982b3..8418d34c 100644 --- a/lib/awful/rules.lua.in +++ b/lib/awful/rules.lua.in @@ -38,7 +38,8 @@ module("awful.rules") --

Note that all "rule" entries need to match. If any of the entry does not -- match, the rule won't be applied.

--

If a client matches multiple rules, their applied in the order they are --- put in this global rules table. +-- put in this global rules table. If the value of a rule is a string, then the +-- match function is used to determine if the client matches the rule.

-- -- @class table -- @name rules @@ -50,8 +51,12 @@ rules = {} -- @return True if it matches, false otherwise. function match(c, rule) for field, value in pairs(rule) do - if c[field] and not c[field]:match(value) then - return false + if c[field] then + if type(c[field]) == "string" and not c[field]:match(value) then + return false + elseif c[field] ~= value then + return false + end end end return true