summaryrefslogtreecommitdiff
path: root/hyprtester/test.lua
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-05-06 13:56:12 +0100
committerGitHub <noreply@github.com>2026-05-06 13:56:12 +0100
commit1681bea42dd2f11ba3fe6df05560d0b231de3c76 (patch)
tree899103dbddf675a01758c7cdd379224c9c81a7fb /hyprtester/test.lua
parent5f1350f522d3fe3af78cbe30a98311763b3509d5 (diff)
config/lua: add simple layout API (#14258)
Adds a simple layout lua api
Diffstat (limited to 'hyprtester/test.lua')
-rw-r--r--hyprtester/test.lua29
1 files changed, 29 insertions, 0 deletions
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,
+})
+