auto focus on new clients unless it has "no_autofocus" property

This commit is contained in:
Freehaha 2013-08-24 00:40:11 +10:00
parent 83a69e0b19
commit c3f96594fd
1 changed files with 10 additions and 3 deletions

View File

@ -113,7 +113,9 @@ local function match_client(c, startup)
local rules = class_client[low] local rules = class_client[low]
if c.transient_for and settings.group_children == true then if c.transient_for and settings.group_children == true then
c.sticky = c.transient_for.sticky or false 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 elseif rules then
local ret = apply_properties(c,{},rules.properties) local ret = apply_properties(c,{},rules.properties)
if ret then return ret end 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 elseif awful.tag.getproperty(tags[1],"no_focus_stealing") then
c.urgent = true c.urgent = true
end end
if not rules.properties.no_autofocus then
capi.client.focus = c
end
return return
end end
end end
--Add to the current tag if not exclusive --Add to the current tag if not exclusive
local cur_tag = awful.tag.selected(c.screen) local cur_tag = awful.tag.selected(c.screen)
if awful.tag.getproperty(cur_tag,"exclusive") ~= true then 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 end
--Last resort, create a new tag --Last resort, create a new tag
class_client[low] = class_client[low] or {tags={},properties={}} 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, } settings = settings, tags_by_name = tags_hash, }
local setter = {tags = load_tags} 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}) 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})