diff --git a/awesomerc.lua.in b/awesomerc.lua.in index bfc5791e..bdf0c290 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -334,7 +334,7 @@ awful.rules.rules = { { rule = { }, properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, - focus = true, + focus = awful.client.focus.filter, keys = clientkeys, buttons = clientbuttons } }, { rule = { class = "MPlayer" }, diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in index 0d532061..c8be765f 100644 --- a/lib/awful/rules.lua.in +++ b/lib/awful/rules.lua.in @@ -65,6 +65,8 @@ local rules = {} --

If a client matches multiple rules, their applied in the order they are -- 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.

+--

If the value of a property is a function, that function gets called and +-- function's return value is used for the property.

-- --

To match multiple clients to a rule one need to use slightly different -- syntax: @@ -165,6 +167,9 @@ function rules.apply(c) end for property, value in pairs(props) do + if property ~= "focus" and type(value) == "function" then + value = value(c) + end if property == "floating" then aclient.floating.set(c, value) elseif property == "tag" then @@ -198,7 +203,7 @@ function rules.apply(c) -- Do this at last so we do not erase things done by the focus -- signal. - if props.focus then + if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then client.focus = c end end