small fix

This commit is contained in:
Crylia
2022-06-16 00:49:57 +02:00
parent fb22b50a97
commit 6e1cc7eaa4

View File

@@ -123,12 +123,16 @@ return function(s)
local i = 1 local i = 1
local sel = nil local sel = nil
local select_next = function() awesome.connect_signal(
if #objects_sorted >= i then "window_switcher::select_next",
selected = objects_sorted[i].pid function()
sel = selected if not object.valid then
return
end
if #objects_sorted >= i then
selected = objects_sorted[i].pid
sel = selected
if object.valid then
if selected == object.pid then if selected == object.pid then
window_element.border_color = Theme_config.window_switcher.selected_border_color window_element.border_color = Theme_config.window_switcher.selected_border_color
window_element.fg = Theme_config.window_switcher.selected_fg window_element.fg = Theme_config.window_switcher.selected_fg
@@ -139,17 +143,12 @@ return function(s)
window_element.bg = Theme_config.window_switcher.bg window_element.bg = Theme_config.window_switcher.bg
end end
end end
if #objects_sorted > i then
i = i + 1
else
i = 1
end
end end
if #objects_sorted > i then
i = i + 1
else
i = 1
end
end
awesome.connect_signal(
"window_switcher::select_next",
select_next
) )
object:connect_signal( object:connect_signal(
@@ -162,6 +161,9 @@ return function(s)
selected = objects_sorted[1].pid selected = objects_sorted[1].pid
end end
-- remove object from table -- remove object from table
if not object.valid then
return
end
for _, object in ipairs(objects) do for _, object in ipairs(objects) do
if object.pid == c.pid then if object.pid == c.pid then
table.remove(objects, _) table.remove(objects, _)
@@ -180,25 +182,30 @@ return function(s)
awesome.connect_signal( awesome.connect_signal(
"window_switcher::raise", "window_switcher::raise",
function() function()
if not object.valid then
return
end
if objects_sorted[i] then if objects_sorted[i] then
if object.valid then if sel == object.pid then
if sel == object.pid then if not object:isvisible() and object.first_tag then
object:jump_to() object.first_tag:view_only()
end end
object:emit_signal('request::activate')
object:raise()
end
-- Reset window switcher -- Reset window switcher
i = 1 i = 1
selected = objects_sorted[i].pid selected = objects_sorted[i].pid
sel = selected sel = selected
if selected == object.pid then if selected == object.pid then
window_element.border_color = Theme_config.window_switcher.selected_border_color window_element.border_color = Theme_config.window_switcher.selected_border_color
window_element.fg = Theme_config.window_switcher.selected_fg window_element.fg = Theme_config.window_switcher.selected_fg
window_element.bg = Theme_config.window_switcher.bg window_element.bg = Theme_config.window_switcher.bg
else else
window_element.border_color = Theme_config.window_switcher.border_color window_element.border_color = Theme_config.window_switcher.border_color
window_element.fg = Theme_config.window_switcher.element_fg window_element.fg = Theme_config.window_switcher.element_fg
window_element.bg = Theme_config.window_switcher.selected_bg window_element.bg = Theme_config.window_switcher.selected_bg
end
end end
end end
end end