style: re-format
This commit is contained in:
+30
-30
@@ -8,30 +8,30 @@ local M = {}
|
||||
local modules = {}
|
||||
|
||||
local function is_module_exists(name)
|
||||
return utils.is_file_exists(HYPR .. "/lua/modules/" .. name .. ".lua")
|
||||
return utils.is_file_exists(HYPR .. "/lua/modules/" .. name .. ".lua")
|
||||
end
|
||||
|
||||
local function load_module(name)
|
||||
if not is_module_exists(name) then
|
||||
return {}
|
||||
end
|
||||
local default_mod = require("lua.modules." .. name)
|
||||
if not is_module_exists(name) then
|
||||
return {}
|
||||
end
|
||||
local default_mod = require("lua.modules." .. name)
|
||||
|
||||
local user_modname = "lua.user.modules." .. name
|
||||
local mod = utils.extend_config(default_mod, user_modname)
|
||||
local user_modname = "lua.user.modules." .. name
|
||||
local mod = utils.extend_config(default_mod, user_modname)
|
||||
|
||||
return mod
|
||||
return mod
|
||||
end
|
||||
|
||||
for name, enabled in pairs(settings.modules) do
|
||||
if enabled then
|
||||
local mod = load_module(name)
|
||||
print("module " .. name .. " loaded.")
|
||||
table.insert(modules, {
|
||||
name = name,
|
||||
config = mod,
|
||||
})
|
||||
end
|
||||
if enabled then
|
||||
local mod = load_module(name)
|
||||
print("module " .. name .. " loaded.")
|
||||
table.insert(modules, {
|
||||
name = name,
|
||||
config = mod,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
M.autostart = {}
|
||||
@@ -40,27 +40,27 @@ M.binds = {}
|
||||
M.envs = {}
|
||||
|
||||
local function collect_modules_prop(module, prop)
|
||||
if module[prop] then
|
||||
M[prop] = utils.list_extend(M[prop], module[prop])
|
||||
end
|
||||
if module[prop] then
|
||||
M[prop] = utils.list_extend(M[prop], module[prop])
|
||||
end
|
||||
end
|
||||
|
||||
for _, item in ipairs(modules) do
|
||||
local module = item.config
|
||||
collect_modules_prop(module, "autostart")
|
||||
collect_modules_prop(module, "autostop")
|
||||
collect_modules_prop(module, "binds")
|
||||
collect_modules_prop(module, "envs")
|
||||
local module = item.config
|
||||
collect_modules_prop(module, "autostart")
|
||||
collect_modules_prop(module, "autostop")
|
||||
collect_modules_prop(module, "binds")
|
||||
collect_modules_prop(module, "envs")
|
||||
end
|
||||
|
||||
function M.load()
|
||||
events.map("hyprland.start", M.autostart)
|
||||
events.map("hyprland.shutdown", M.autostop)
|
||||
events.map("hyprland.start", M.autostart)
|
||||
events.map("hyprland.shutdown", M.autostop)
|
||||
|
||||
bind.map(M.binds)
|
||||
for name, value in pairs(M.envs) do
|
||||
hl.env(name, value)
|
||||
end
|
||||
bind.map(M.binds)
|
||||
for name, value in pairs(M.envs) do
|
||||
hl.env(name, value)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user