rc.lua: Use request::activate instead of client.focus.
For a long time, it was deemed overkill and made rc.lua less readable without the documentation. However it is now clear that it's handling of unfocusable clients and general bypassing of both `awful.client.focus.filter` and `awful.ewmh.activate` filters causes bugs. Fixing them individually in each instance of `rc.lua` `client.focus = c` would add so much code that all the clarity provided by not using request::activate would be burried in boilerplate code. Fix #2328
This commit is contained in:
parent
091adca070
commit
e0d1b404c5
|
@ -155,16 +155,11 @@ local tasklist_buttons = gears.table.join(
|
||||||
if c == client.focus then
|
if c == client.focus then
|
||||||
c.minimized = true
|
c.minimized = true
|
||||||
else
|
else
|
||||||
-- Without this, the following
|
c:emit_signal(
|
||||||
-- :isvisible() makes no sense
|
"request::activate",
|
||||||
c.minimized = false
|
"tasklist",
|
||||||
if not c:isvisible() and c.first_tag then
|
{raise = true}
|
||||||
c.first_tag:view_only()
|
)
|
||||||
end
|
|
||||||
-- This will also un-minimize
|
|
||||||
-- the client, if needed
|
|
||||||
client.focus = c
|
|
||||||
c:raise()
|
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
awful.button({ }, 3, client_menu_toggle_fn()),
|
awful.button({ }, 3, client_menu_toggle_fn()),
|
||||||
|
@ -335,8 +330,9 @@ globalkeys = gears.table.join(
|
||||||
local c = awful.client.restore()
|
local c = awful.client.restore()
|
||||||
-- Focus restored client
|
-- Focus restored client
|
||||||
if c then
|
if c then
|
||||||
client.focus = c
|
c:emit_signal(
|
||||||
c:raise()
|
"request::activate", "key.unminimize", {raise = true}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
{description = "restore minimized", group = "client"}),
|
{description = "restore minimized", group = "client"}),
|
||||||
|
@ -459,17 +455,14 @@ end
|
||||||
-- @DOC_CLIENT_BUTTONS@
|
-- @DOC_CLIENT_BUTTONS@
|
||||||
clientbuttons = gears.table.join(
|
clientbuttons = gears.table.join(
|
||||||
awful.button({ }, 1, function (c)
|
awful.button({ }, 1, function (c)
|
||||||
client.focus = c;
|
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||||
c:raise()
|
|
||||||
end),
|
end),
|
||||||
awful.button({ modkey }, 1, function (c)
|
awful.button({ modkey }, 1, function (c)
|
||||||
client.focus = c
|
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||||
c:raise()
|
|
||||||
awful.mouse.client.move(c)
|
awful.mouse.client.move(c)
|
||||||
end),
|
end),
|
||||||
awful.button({ modkey }, 3, function (c)
|
awful.button({ modkey }, 3, function (c)
|
||||||
client.focus = c
|
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||||
c:raise()
|
|
||||||
awful.mouse.client.resize(c)
|
awful.mouse.client.resize(c)
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
@ -559,13 +552,11 @@ client.connect_signal("request::titlebars", function(c)
|
||||||
-- buttons for the titlebar
|
-- buttons for the titlebar
|
||||||
local buttons = gears.table.join(
|
local buttons = gears.table.join(
|
||||||
awful.button({ }, 1, function()
|
awful.button({ }, 1, function()
|
||||||
client.focus = c
|
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||||
c:raise()
|
|
||||||
awful.mouse.client.move(c)
|
awful.mouse.client.move(c)
|
||||||
end),
|
end),
|
||||||
awful.button({ }, 3, function()
|
awful.button({ }, 3, function()
|
||||||
client.focus = c
|
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||||
c:raise()
|
|
||||||
awful.mouse.client.resize(c)
|
awful.mouse.client.resize(c)
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
@ -598,10 +589,7 @@ end)
|
||||||
|
|
||||||
-- Enable sloppy focus, so that focus follows mouse.
|
-- Enable sloppy focus, so that focus follows mouse.
|
||||||
client.connect_signal("mouse::enter", function(c)
|
client.connect_signal("mouse::enter", function(c)
|
||||||
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
c:emit_signal("request::activate", "mouse_enter", {raise = true})
|
||||||
and awful.client.focus.filter(c) then
|
|
||||||
client.focus = c
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- @DOC_BORDER@
|
-- @DOC_BORDER@
|
||||||
|
|
Loading…
Reference in New Issue