Use signals on classes instead of instances where appropriate

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-03-23 19:48:07 +01:00
parent 23659817bc
commit b4c83d0e70
3 changed files with 11 additions and 13 deletions

View File

@ -369,14 +369,6 @@ awful.rules.rules = {
-- {{{ Signals -- {{{ Signals
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c) client.connect_signal("manage", function (c)
-- Enable sloppy focus
c:connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
if not awesome.startup then if not awesome.startup then
-- Set the windows at the slave, -- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master. -- i.e. put it at the end of others instead of setting it master.
@ -435,6 +427,14 @@ client.connect_signal("manage", function (c)
end end
end) end)
-- Enable sloppy focus
client.connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}} -- }}}

View File

@ -613,9 +613,7 @@ capi.client.connect_signal("new", function(c)
c:connect_signal("property::border_width", store_init_geometry) c:connect_signal("property::border_width", store_init_geometry)
end) end)
capi.client.connect_signal("manage", function(c) capi.client.connect_signal("property::geometry", store_floating_geometry)
c:connect_signal("property::geometry", store_floating_geometry)
end)
--- Return if a client has a fixe size or not. --- Return if a client has a fixe size or not.
-- @param c The client. -- @param c The client.
@ -958,7 +956,7 @@ capi.client.add_signal("unmarked")
capi.client.connect_signal("focus", client.focus.history.add) capi.client.connect_signal("focus", client.focus.history.add)
capi.client.connect_signal("unmanage", client.focus.history.delete) capi.client.connect_signal("unmanage", client.focus.history.delete)
capi.client.connect_signal("manage", function(c) c:connect_signal("property::urgent", client.urgent.add) end) capi.client.connect_signal("property::urgent", client.urgent.add)
capi.client.connect_signal("focus", client.urgent.delete) capi.client.connect_signal("focus", client.urgent.delete)
capi.client.connect_signal("unmanage", client.urgent.delete) capi.client.connect_signal("unmanage", client.urgent.delete)

View File

@ -567,10 +567,10 @@ capi.client.connect_signal("manage", function(c, startup)
c.screen = capi.mouse.screen c.screen = capi.mouse.screen
end end
end end
c:connect_signal("property::screen", tag.withcurrent)
end) end)
capi.client.connect_signal("manage", tag.withcurrent) capi.client.connect_signal("manage", tag.withcurrent)
capi.client.connect_signal("property::screen", tag.withcurrent)
capi.tag.connect_signal("request::select", tag.viewonly) capi.tag.connect_signal("request::select", tag.viewonly)
capi.tag.add_signal("property::hide") capi.tag.add_signal("property::hide")