From c3f96594fd284cfca3e60bad2313a3347458f3ba Mon Sep 17 00:00:00 2001 From: Freehaha Date: Sat, 24 Aug 2013 00:40:11 +1000 Subject: [PATCH] auto focus on new clients unless it has "no_autofocus" property --- init.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index ebb843c..f68157c 100755 --- a/init.lua +++ b/init.lua @@ -113,7 +113,9 @@ local function match_client(c, startup) local rules = class_client[low] if c.transient_for and settings.group_children == true then c.sticky = c.transient_for.sticky or false - return c:tags(c.transient_for:tags()) + c:tags(c.transient_for:tags()) + capi.client.focus = c + return elseif rules then local ret = apply_properties(c,{},rules.properties) if ret then return ret end @@ -141,13 +143,18 @@ local function match_client(c, startup) elseif awful.tag.getproperty(tags[1],"no_focus_stealing") then c.urgent = true end + if not rules.properties.no_autofocus then + capi.client.focus = c + end return end end --Add to the current tag if not exclusive local cur_tag = awful.tag.selected(c.screen) if awful.tag.getproperty(cur_tag,"exclusive") ~= true then - return c:tags({cur_tag}) + c:tags({cur_tag}) + capi.client.focus = c + return true end --Last resort, create a new tag class_client[low] = class_client[low] or {tags={},properties={}} @@ -237,4 +244,4 @@ local getter = {properties = setmetatable({}, {__newindex = function(table,k,v settings = settings, tags_by_name = tags_hash, } local setter = {tags = load_tags} -return setmetatable(module,{__index=function(t,k) return getter[k] end,__newindex=function(t,k,v) if setter[k] then return setter[k](v) end end}) \ No newline at end of file +return setmetatable(module,{__index=function(t,k) return getter[k] end,__newindex=function(t,k,v) if setter[k] then return setter[k](v) end end})