mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
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
1 changed files with 14 additions and 26 deletions
|
@ -155,16 +155,11 @@ local tasklist_buttons = gears.table.join(
|
|||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
-- Without this, the following
|
||||
-- :isvisible() makes no sense
|
||||
c.minimized = false
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
-- This will also un-minimize
|
||||
-- the client, if needed
|
||||
client.focus = c
|
||||
c:raise()
|
||||
c:emit_signal(
|
||||
"request::activate",
|
||||
"tasklist",
|
||||
{raise = true}
|
||||
)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, client_menu_toggle_fn()),
|
||||
|
@ -335,8 +330,9 @@ globalkeys = gears.table.join(
|
|||
local c = awful.client.restore()
|
||||
-- Focus restored client
|
||||
if c then
|
||||
client.focus = c
|
||||
c:raise()
|
||||
c:emit_signal(
|
||||
"request::activate", "key.unminimize", {raise = true}
|
||||
)
|
||||
end
|
||||
end,
|
||||
{description = "restore minimized", group = "client"}),
|
||||
|
@ -459,17 +455,14 @@ end
|
|||
-- @DOC_CLIENT_BUTTONS@
|
||||
clientbuttons = gears.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
client.focus = c;
|
||||
c:raise()
|
||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||
end),
|
||||
awful.button({ modkey }, 1, function (c)
|
||||
client.focus = c
|
||||
c:raise()
|
||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ modkey }, 3, function (c)
|
||||
client.focus = c
|
||||
c:raise()
|
||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
)
|
||||
|
@ -559,13 +552,11 @@ client.connect_signal("request::titlebars", function(c)
|
|||
-- buttons for the titlebar
|
||||
local buttons = gears.table.join(
|
||||
awful.button({ }, 1, function()
|
||||
client.focus = c
|
||||
c:raise()
|
||||
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ }, 3, function()
|
||||
client.focus = c
|
||||
c:raise()
|
||||
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
)
|
||||
|
@ -598,10 +589,7 @@ end)
|
|||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
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
|
||||
c:emit_signal("request::activate", "mouse_enter", {raise = true})
|
||||
end)
|
||||
|
||||
-- @DOC_BORDER@
|
||||
|
|
Loading…
Reference in a new issue