commit
cded8b0837
|
@ -21,6 +21,7 @@ local client = require("awful.client")
|
||||||
local ascreen = require("awful.screen")
|
local ascreen = require("awful.screen")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
local gmath = require("gears.math")
|
local gmath = require("gears.math")
|
||||||
|
local protected_call = require("gears.protected_call")
|
||||||
|
|
||||||
local function get_screen(s)
|
local function get_screen(s)
|
||||||
return s and capi.screen[s]
|
return s and capi.screen[s]
|
||||||
|
@ -197,6 +198,8 @@ function layout.arrange(screen)
|
||||||
if arrange_lock then return end
|
if arrange_lock then return end
|
||||||
arrange_lock = true
|
arrange_lock = true
|
||||||
|
|
||||||
|
-- protected call to ensure that arrange_lock will be reset
|
||||||
|
protected_call(function()
|
||||||
local p = layout.parameters(nil, screen)
|
local p = layout.parameters(nil, screen)
|
||||||
|
|
||||||
local useless_gap = p.useless_gap
|
local useless_gap = p.useless_gap
|
||||||
|
@ -210,6 +213,7 @@ function layout.arrange(screen)
|
||||||
g.y = g.y + useless_gap
|
g.y = g.y + useless_gap
|
||||||
c:geometry(g)
|
c:geometry(g)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
arrange_lock = false
|
arrange_lock = false
|
||||||
delayed_arrange[screen] = nil
|
delayed_arrange[screen] = nil
|
||||||
|
|
||||||
|
|
|
@ -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