awful.tag.new: Handle too few given layouts
When awful.tag.new() got a list of layouts shorter than the list of names, it would previously create tags with nil as their layout. This commit changes this so that the first layout is repeated if necessary. Related-to: https://github.com/awesomeWM/awesome/issues/1853 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
de05ee6678
commit
20d15b8be6
|
@ -240,11 +240,15 @@ end
|
||||||
-- @return A table with all created tags.
|
-- @return A table with all created tags.
|
||||||
function tag.new(names, screen, layout)
|
function tag.new(names, screen, layout)
|
||||||
screen = get_screen(screen or 1)
|
screen = get_screen(screen or 1)
|
||||||
|
-- True if `layout` should be used as the layout of each created tag
|
||||||
|
local have_single_layout = (not layout) or (layout.arrange and layout.name)
|
||||||
local tags = {}
|
local tags = {}
|
||||||
for id, name in ipairs(names) do
|
for id, name in ipairs(names) do
|
||||||
table.insert(tags, id, tag.add(name, {screen = screen,
|
local l = layout
|
||||||
layout = (layout and layout[id]) or
|
if not have_single_layout then
|
||||||
layout}))
|
l = layout[id] or layout[1]
|
||||||
|
end
|
||||||
|
table.insert(tags, id, tag.add(name, {screen = screen, layout = l}))
|
||||||
-- Select the first tag.
|
-- Select the first tag.
|
||||||
if id == 1 then
|
if id == 1 then
|
||||||
tags[id].selected = true
|
tags[id].selected = true
|
||||||
|
|
Loading…
Reference in New Issue