Hi,

The possibility to add an exception to a rule (over, adding multiple
rules) was discussed on the user mailing list here[1]. This patch is
just an outcome of that; tested on my machine.

>From commit message:

rules: allow defining exceptions to a rule

So you want to make all Firefox windows floating except the main window
(instance = Navigator). You can either list all possible windows in
rules and make them floating, or make all of them floating except one:

{ rule = { class = "Firefox" },
  rule_no = { instance = "Navigator" },
  properties = {floating = true},
}

[1] http://article.gmane.org/gmane.comp.window-managers.awesome/7051/

-- 
Anurag Priyam
http://about.me/yeban/
From d933ab3130500dbc9ccfa170470a125edc27094a Mon Sep 17 00:00:00 2001
From: Anurag Priyam <[email protected]>
Date: Sun, 27 Mar 2011 19:29:45 +0530
Subject: [PATCH] rules: allow defining exceptions to a rule

So you want to make all Firefox windows floating except the main window
(instance = Navigator). You can either list all possible windows in
rules and make them floating, or make all of them floating except one:

{ rule = { class = "Firefox" },
  rule_no = { instance = "Navigator" },
  properties = {floating = true},
}

Signed-off-by: Anurag Priyam <[email protected]>
---
 lib/awful/rules.lua.in |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in
index 1b1c390..1d8db95 100644
--- a/lib/awful/rules.lua.in
+++ b/lib/awful/rules.lua.in
@@ -74,6 +74,17 @@ module("awful.rules")
 -- </code>
 -- </p>
 --
+-- <p> To match multiple clients with an exception one can couple 'rule_no' with
+-- either 'rule' or 'rule_any', using the same semantics:
+-- <br/>
+-- <code>
+-- { rule = { class = "Firefox" },
+--   rule_no = { instance = "Navigator" },
+--   properties = {floating = true},
+-- },
+-- </code>
+-- </p>
+--
 -- @class table
 -- @name rules
 rules = {}
@@ -124,8 +135,8 @@ function apply(c)
     local props = {}
     local callbacks = {}
     for _, entry in ipairs(rules) do
-        if  (entry.rule and match(c, entry.rule)) or
-            (entry.rule_any and match_any(c, entry.rule_any)) then
+        if  (entry.rule and match(c, entry.rule) and not match(c, entry.rule_no)) or
+            (entry.rule_any and match_any(c, entry.rule_any) and not match_any(c, entry.rule_no)) then
             if entry.properties then
                 for property, value in pairs(entry.properties) do
                     props[property] = value
-- 
1.7.4.1

Reply via email to