-- This file is part of Reno desktop. -- -- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -- -- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see . -- Since it would seem that get_widget_by_id is still an open issue (https://github.com/awesomeWM/awesome/issues/2945, https://github.com/awesomeWM/awesome/issues/2181), this abomination is the nuclear solution to finding **ALL** widgets that don't get indexed because they are separated by an already instantiated widget. If you use this, please, use it carefully. Don't call it more than you really need, cache the results if you have to. -- Hypothetically, if there occurs such a thing as widget cycle, this will get stuck. Also it's very expensive. return function(widget, id) local results = {} local checked = {} local function walker(widget, id) if widget.children then for _,v in pairs(widget:get_children()) do if (v.id == id) and (not checked[v]) then table.insert(results, v) checked[v] = true end if (v._private.by_id and v._private.by_id[id]) then for _,v2 in pairs(v._private.by_id[id]) do if not checked[v2] then table.insert(results,v2) checked[v2] = true end end end walker(v, id) end end end walker(widget, id) return results end