Use fair layout by default, switching to horizontal.fair for portrait screens

This commit is contained in:
Alexander Gehrke 2020-10-05 10:49:26 +02:00
parent 2f25e69509
commit 74d7df8f14

View file

@ -80,12 +80,20 @@ local tagdef = {
{"F4", { layout = awful.layout.suit.max }}, {"F4", { layout = awful.layout.suit.max }},
} }
function defaultlayout(s)
if s.geometry.width > s.geometry.height then
return awful.layout.suit.fair
else
return awful.layout.suit.fair.horizontal
end
end
function tags.setup() function tags.setup()
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
for _,t in ipairs(tagdef) do for _,t in ipairs(tagdef) do
awful.tag.add(t[1], awful.util.table.join( awful.tag.add(t[1], awful.util.table.join(
{screen = s}, {screen = s},
t[2] or { layout = awful.layout.layouts[1] } t[2] or { layout = defaultlayout(s) }
)) ))
end end
s.tags[1]:view_only() s.tags[1]:view_only()