mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-14 04:58:10 +02:00
15 lines
314 B
Lua
15 lines
314 B
Lua
|
|
hl.layout.register("grid", {
|
||
|
|
recalculate = function(ctx)
|
||
|
|
local n = #ctx.targets
|
||
|
|
if n == 0 then
|
||
|
|
return
|
||
|
|
end
|
||
|
|
|
||
|
|
local cols = math.ceil(math.sqrt(n))
|
||
|
|
|
||
|
|
for i, target in ipairs(ctx.targets) do
|
||
|
|
target:place(ctx:grid_cell(i, cols))
|
||
|
|
end
|
||
|
|
end,
|
||
|
|
})
|