Fix dock on startup

This commit is contained in:
Crylia
2022-06-18 10:40:27 +02:00
parent 6e1cc7eaa4
commit 7280db1a5b

View File

@@ -88,7 +88,7 @@ return function(screen, programs)
visible = true, visible = true,
screen = screen, screen = screen,
type = "dock", type = "dock",
height = User_config.dock_icon_size + 10, height = dpi(User_config.dock_icon_size + 10),
placement = function(c) awful.placement.bottom(c, { margins = dpi(10) }) end, placement = function(c) awful.placement.bottom(c, { margins = dpi(10) }) end,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(16)) gears.shape.rounded_rect(cr, width, height, dpi(16))
@@ -192,7 +192,8 @@ return function(screen, programs)
} }
local function check_for_dock_hide(s) local function check_for_dock_hide(s)
for _, client in ipairs(s.selected_tag:clients()) do local clients_on_tag = s.selected_tag:clients()
for _, client in ipairs(clients_on_tag) do
if client.fullscreen then if client.fullscreen then
dock.visible = false dock.visible = false
fakedock.visible = false fakedock.visible = false
@@ -200,21 +201,20 @@ return function(screen, programs)
fakedock.visible = true fakedock.visible = true
end end
end end
if #s.selected_tag:clients() < 1 then if #clients_on_tag < 1 then
dock.visible = true dock.visible = true
return return
end end
if s == mouse.screen then if s == mouse.screen then
local minimized local minimized = false
for _, c in ipairs(s.selected_tag:clients()) do for _, c in ipairs(clients_on_tag) do
if c.minimized then
minimized = true
end
if c.maximized or c.fullscreen then if c.maximized or c.fullscreen then
dock.visible = false dock.visible = false
return return
end end
if not c.minimized then if c.minimized then
minimized = true
else
local y = c:geometry().y local y = c:geometry().y
local h = c.height local h = c.height
if (y + h) >= s.geometry.height - User_config.dock_icon_size - 35 then if (y + h) >= s.geometry.height - User_config.dock_icon_size - 35 then
@@ -251,6 +251,10 @@ return function(screen, programs)
dock.visible = true dock.visible = true
end end
end end
if #screen.clients < 1 then
dock.visible = true
dock_intelligent_hide:stop()
end
end end
) )
@@ -313,6 +317,12 @@ return function(screen, programs)
"mouse::leave", "mouse::leave",
function() function()
dock_intelligent_hide:again() dock_intelligent_hide:again()
dock.visible = false
end end
) )
dock:setup {
dock_elements,
create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical
}
end end