From 8a4d0d2df79cead6ab6e5fd1fe32f4ae37674961 Mon Sep 17 00:00:00 2001 From: elenapan Date: Tue, 5 May 2020 16:24:23 +0300 Subject: [PATCH] Raise originally focused client before chosen client in window switcher --- config/awesome/elemental/window_switcher.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config/awesome/elemental/window_switcher.lua b/config/awesome/elemental/window_switcher.lua index 2a53417..5c921cc 100644 --- a/config/awesome/elemental/window_switcher.lua +++ b/config/awesome/elemental/window_switcher.lua @@ -166,13 +166,22 @@ get_num_clients = function(s) return minimized_clients_in_tag + #s.clients end +-- The client that was focused when the window_switcher was activated +local window_switcher_first_client -- Keygrabber configuration -- Helper functions for keybinds local window_switcher_grabber window_switcher_hide = function() -- Add currently focused client to history if client.focus then - awful.client.focus.history.add(client.focus) + local window_switcher_last_client = client.focus + awful.client.focus.history.add(window_switcher_last_client) + -- Raise client that was focused originally + -- Then raise last focused client + if window_switcher_first_client then + window_switcher_first_client:raise() + window_switcher_last_client:raise() + end end -- Resume recording focus history awful.client.focus.history.enable_tracking() @@ -221,6 +230,8 @@ function window_switcher_show(s) if get_num_clients(s) == 0 then return end + -- Store client that is focused in a variable + window_switcher_first_client = client.focus -- Stop recording focus history awful.client.focus.history.disable_tracking()