From ae5fc042aed9e161db0ea325b996f2ae5b79a3be Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sat, 18 Aug 2018 17:57:23 -0400 Subject: [PATCH] layout: Add a get_tag_layout_index function. It helps check of the current tag layout is part of awful.layout.layouts --- lib/awful/layout/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 4a50cebab..7ef4d5f5e 100644 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -21,6 +21,7 @@ local client = require("awful.client") local ascreen = require("awful.screen") local timer = require("gears.timer") local gmath = require("gears.math") +local gtable = require("gears.table") local protected_call = require("gears.protected_call") local function get_screen(s) @@ -73,6 +74,16 @@ 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 avoids recurring call by emitted signals.