diff --git a/src/awesomewmdtl/visitors/module_dependencies.tl b/src/awesomewmdtl/visitors/module_dependencies.tl index 8297268..be26c37 100644 --- a/src/awesomewmdtl/visitors/module_dependencies.tl +++ b/src/awesomewmdtl/visitors/module_dependencies.tl @@ -4,6 +4,23 @@ local utils = require("awesomewmdtl.utils") local spread = utils.spread +-- Very hacky way to get the module path of a capi class +-- We shouldn't rely on partial record for Node +local capi_class : { string : Node } = { + Client = { + name = "Client", + module_path = "awful.client", + }, + Screen = { + name = "Screen", + module_path = "awful.screen", + }, + Tag = { + name = "Tag", + module_path = "awful.tag", + }, +} + local function get_all_types_in_node(node: Node): { string } local parameters_types = {} if node.parameters then @@ -57,7 +74,7 @@ function Module_Dependencies.visit(node: Node, mod: Node, d: Dag) goto continue end - local dependency = d.modules[type_name] or d.modules[utils.lowercase(type_name)] + local dependency = d.modules[type_name] or d.modules[utils.lowercase(type_name)] or capi_class[type_name] if dependency then if dependency.name ~= mod.name then mod.dependencies[dependency.name] = dependency.module_path