Files
dotfiles/.config/hypr/hypr/hyprland/layout.lua
2026-07-17 15:25:20 +02:00

46 lines
1.5 KiB
Lua

hl.config({
dwindle = {
preserve_split = true,
smart_split = false, -- No splitting based on cursor position
force_split = 2, -- Always split to the right
},
master = {
new_status = "slave", -- New windows are added as slaves
mfact = 0.7,
orientation = "right"
}
})
-- I needed to create a custom layout, because I can only configure the master layout's
-- orientation globally, and this layout is used specifically for a vertical monitor.
local focus_split = 0.66
hl.layout.register("vertical", {
recalculate = function(ctx)
local n = #ctx.targets
if n == 0 then return end
-- First, we place the first target in the focus area
local focus_area = ctx:split(ctx.area, "bottom", focus_split)
ctx.targets[1]:place(focus_area)
-- Then we split the remaining area into equal parts for the other targets (left-to-right)
local remaining_area = ctx:split(ctx.area, "top", 1 - focus_split)
local remaining = n - 1
for i, target in ipairs(ctx.targets) do
if i == 1 then goto continue end -- Skip the first target, it's already placed
local remaining_split = 1 / remaining
local target_area = ctx:split(remaining_area, "left", remaining_split)
remaining_area = ctx:split(remaining_area, "right", 1 - remaining_split)
remaining = remaining - 1
target:place(target_area)
::continue::
end
end
})