layout: Add a get_tag_layout_index function.
It helps check of the current tag layout is part of awful.layout.layouts
This commit is contained in:
parent
7020a9707f
commit
ae5fc042ae
|
@ -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 gtable = require("gears.table")
|
||||||
local protected_call = require("gears.protected_call")
|
local protected_call = require("gears.protected_call")
|
||||||
|
|
||||||
local function get_screen(s)
|
local function get_screen(s)
|
||||||
|
@ -73,6 +74,16 @@ layout.layouts = {
|
||||||
--
|
--
|
||||||
-- @field layout.layouts
|
-- @field layout.layouts
|
||||||
|
|
||||||
|
--- Return the tag layout index (from `awful.layout.layouts`).
|
||||||
|
--
|
||||||
|
-- If the layout isn't part of `awful.layout.layouts`, this function returns
|
||||||
|
-- nil.
|
||||||
|
--
|
||||||
|
-- @tparam tag t The tag.
|
||||||
|
-- @treturn nil|number The layout index.
|
||||||
|
function layout.get_tag_layout_index(t)
|
||||||
|
return gtable.hasitem(layout.layouts, t.layout)
|
||||||
|
end
|
||||||
|
|
||||||
-- This is a special lock used by the arrange function.
|
-- This is a special lock used by the arrange function.
|
||||||
-- This avoids recurring call by emitted signals.
|
-- This avoids recurring call by emitted signals.
|
||||||
|
|
Loading…
Reference in New Issue