rc.lua: Get rid of the focus related imperative logic.

This commit is contained in:
Emmanuel Lepage Vallee 2019-10-19 18:32:26 -04:00 committed by Emmanuel Lepage-Vallee
parent cd253ed815
commit 1434ea4c8b
1 changed files with 10 additions and 23 deletions

View File

@ -157,21 +157,14 @@ screen.connect_signal("request::desktop_decoration", function(s)
} }
} }
-- @TASKLIST_BUTTON@
-- Create a tasklist widget -- Create a tasklist widget
s.mytasklist = awful.widget.tasklist { s.mytasklist = awful.widget.tasklist {
screen = s, screen = s,
filter = awful.widget.tasklist.filter.currenttags, filter = awful.widget.tasklist.filter.currenttags,
buttons = { buttons = {
awful.button({ }, 1, function (c) awful.button({ }, 1, function (c)
if c == client.focus then c:activate { context = "tasklist", action = "toggle_minimization" }
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end), end),
awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end), awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
awful.button({ }, 4, function() awful.client.focus.byidx( 1) end), awful.button({ }, 4, function() awful.client.focus.byidx( 1) end),
@ -286,9 +279,7 @@ awful.keyboard.append_global_keybindings({
local c = awful.client.restore() local c = awful.client.restore()
-- Focus restored client -- Focus restored client
if c then if c then
c:emit_signal( c:activate { raise = true, context = "key.unminimize" }
"request::activate", "key.unminimize", {raise = true}
)
end end
end, end,
{description = "restore minimized", group = "client"}), {description = "restore minimized", group = "client"}),
@ -383,15 +374,13 @@ awful.keyboard.append_global_keybindings({
client.connect_signal("request::default_mousebindings", function() client.connect_signal("request::default_mousebindings", function()
awful.mouse.append_client_mousebindings({ awful.mouse.append_client_mousebindings({
awful.button({ }, 1, function (c) awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:activate { context = "mouse_click" }
end), end),
awful.button({ modkey }, 1, function (c) awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:activate { context = "mouse_click", action = "mouse_move" }
awful.mouse.client.move(c)
end), end),
awful.button({ modkey }, 3, function (c) awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:activate { context = "mouse_click", action = "mouse_resize"}
awful.mouse.client.resize(c)
end), end),
}) })
end) end)
@ -528,12 +517,10 @@ client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar -- buttons for the titlebar
local buttons = { local buttons = {
awful.button({ }, 1, function() awful.button({ }, 1, function()
c:emit_signal("request::activate", "titlebar", {raise = true}) c:activate { context = "titlebar", action = "mouse_move" }
awful.mouse.client.move(c)
end), end),
awful.button({ }, 3, function() awful.button({ }, 3, function()
c:emit_signal("request::activate", "titlebar", {raise = true}) c:activate { context = "titlebar", action = "mouse_resize"}
awful.mouse.client.resize(c)
end), end),
} }
@ -565,7 +552,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)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:activate { context = "mouse_enter", raise = false }
end) end)
-- @DOC_BORDER@ -- @DOC_BORDER@