2021-08-19 12:45:51 +02:00
|
|
|
local mylayout = {}
|
|
|
|
|
|
|
|
mylayout.name = "deck"
|
|
|
|
|
|
|
|
function mylayout.arrange(p)
|
|
|
|
local area = p.workarea
|
|
|
|
local t = p.tag or screen[p.screen].selected_tag
|
2023-09-03 17:34:28 +02:00
|
|
|
local mwfact = t.master_width_factor
|
2021-08-19 12:45:51 +02:00
|
|
|
local client_count = #p.clients
|
|
|
|
|
|
|
|
if client_count == 1 then
|
|
|
|
local c = p.clients[1]
|
|
|
|
local g = {
|
|
|
|
x = area.x,
|
|
|
|
y = area.y,
|
|
|
|
width = area.width,
|
|
|
|
height = area.height,
|
|
|
|
}
|
|
|
|
p.geometries[c] = g
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-09-03 17:34:28 +02:00
|
|
|
local xoffset = area.width * 0.5 * (1 - mwfact) / (client_count - 1)
|
|
|
|
local yoffset = area.height * 0.5 * (1 - mwfact) / (client_count - 1)
|
2021-08-19 12:45:51 +02:00
|
|
|
|
2021-08-27 20:01:22 +02:00
|
|
|
for idx = 1, client_count do
|
2021-08-19 12:45:51 +02:00
|
|
|
local c = p.clients[idx]
|
|
|
|
local g = {
|
|
|
|
x = area.x + (idx - 1) * xoffset,
|
|
|
|
y = area.y + (idx - 1) * yoffset,
|
|
|
|
width = area.width - (xoffset * (client_count - 1)),
|
|
|
|
height = area.height - (yoffset * (client_count - 1)),
|
|
|
|
}
|
|
|
|
p.geometries[c] = g
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-11-06 19:33:58 +01:00
|
|
|
return mylayout
|