From 1681bea42dd2f11ba3fe6df05560d0b231de3c76 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Wed, 6 May 2026 13:56:12 +0100 Subject: config/lua: add simple layout API (#14258) Adds a simple layout lua api --- hyprtester/test.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'hyprtester/test.lua') diff --git a/hyprtester/test.lua b/hyprtester/test.lua index f3c77fd7..693513ae 100644 --- a/hyprtester/test.lua +++ b/hyprtester/test.lua @@ -294,3 +294,32 @@ hl.gesture({ fingers = 4, direction = "left", action = function() hl.dispatch(hl hl.gesture({ fingers = 2, direction = "pinch", action = "cursorZoom", zoom_level = "1", mode = "live" }) hl.gesture({ fingers = 2, direction = "right", action = "float", disable_inhibit = true }) + +hl.layout.register("columns", { + recalculate = function(ctx) + local n = #ctx.targets + if n == 0 then + return + end + + for i, target in ipairs(ctx.targets) do + target:place(ctx:column(i, n)) + end + end, +}) + +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, +}) + -- cgit v1.2.3