Make window switcher also cycle through minimized clients

This commit is contained in:
elenapan 2020-08-04 11:00:35 +03:00
parent 1f0e69cfce
commit 0c33554f8e

View file

@ -124,6 +124,9 @@ end
-- The client that was focused when the window_switcher was activated
local window_switcher_first_client
-- The clients that were minimized when the window switcher was
-- activated
local window_switcher_minimized_clients = {}
-- Keygrabber configuration
-- Helper functions for keybinds
@ -140,10 +143,21 @@ window_switcher_hide = function()
window_switcher_last_client:raise()
end
end
-- Minimize originally minimized clients
local s = awful.screen.focused()
local clients = s.selected_tag:clients()
for _, c in pairs(window_switcher_minimized_clients) do
if c and c.valid and not (client.focus and client.focus == c) then
c.minimized = true
end
end
-- Reset helper table
window_switcher_minimized_clients = {}
-- Resume recording focus history
awful.client.focus.history.enable_tracking()
-- Stop and hide window_switcher
local s = awful.screen.focused()
awful.keygrabber.stop(window_switcher_grabber)
s.window_switcher.visible = false
end
@ -200,6 +214,19 @@ function window_switcher_show(s)
-- Go to previously focused client (in the tag)
awful.client.focus.history.previous()
-- Track minimized clients
-- Unminimize them
-- Lower them so that they are always below other
-- originally unminimized windows
local clients = s.selected_tag:clients()
for _, c in pairs(clients) do
if c.minimized then
table.insert(window_switcher_minimized_clients, c)
c.minimized = false
c:lower()
end
end
-- Start the keygrabber
window_switcher_grabber = awful.keygrabber.run(function(_, key, event)
if event == "release" then