just gave up and used an envvar instead
This commit is contained in:
16
autoload.lua
16
autoload.lua
@@ -1,14 +1,30 @@
|
|||||||
-- ~/.config/hypr/autoload.lua
|
-- ~/.config/hypr/autoload.lua
|
||||||
|
|
||||||
-- Path to search
|
-- Path to search
|
||||||
|
local hyprRoot
|
||||||
local modules
|
local modules
|
||||||
|
|
||||||
|
if os.getenv("HYPRLAND_ROOT") then
|
||||||
|
hyprRoot = os.getenv("HYPRLAND_ROOT")
|
||||||
|
else
|
||||||
|
hyprRoot = os.getenv("HOME") .. "/.config/hypr"
|
||||||
|
end
|
||||||
|
|
||||||
if os.getenv("MODULES_ROOT") then
|
if os.getenv("MODULES_ROOT") then
|
||||||
modules = os.getenv("MODULES_ROOT")
|
modules = os.getenv("MODULES_ROOT")
|
||||||
else
|
else
|
||||||
modules = os.getenv("HOME") .. "/.config/hypr/modules"
|
modules = os.getenv("HOME") .. "/.config/hypr/modules"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local pluginsOk, pluginsErr = pcall(dofile, hyprRoot .. "plugins.lua")
|
||||||
|
if not pluginsOk then
|
||||||
|
hl.notification.create({
|
||||||
|
text = "autoload: " .. hyprRoot .. "plugins.lua" .. "\n" .. tostring(pluginsErr),
|
||||||
|
timeout = 8000,
|
||||||
|
icon = "warning",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- Get all files in modules dir
|
-- Get all files in modules dir
|
||||||
local p = io.popen('find -L "' .. modules .. '" -name "*.lua" -type f | sort')
|
local p = io.popen('find -L "' .. modules .. '" -name "*.lua" -type f | sort')
|
||||||
if not p then
|
if not p then
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
runtimePackages = defaultRuntimePkgs;
|
runtimePackages = defaultRuntimePkgs;
|
||||||
exePath = pkgs.lib.getExe hypr;
|
exePath = pkgs.lib.getExe hypr;
|
||||||
env."MODULES_ROOT" = ./modules;
|
env."MODULES_ROOT" = ./modules;
|
||||||
|
env."HYPRLAND_ROOT" = ./.;
|
||||||
flags."--config" = ./hyprland.lua;
|
flags."--config" = ./hyprland.lua;
|
||||||
};
|
};
|
||||||
repo-files = pkgs.stdenvNoCC.mkDerivation {
|
repo-files = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
|||||||
@@ -12,12 +12,5 @@ if handle then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if the plugin module is present
|
|
||||||
-- If it is, require it
|
|
||||||
local ok, err = pcall(dofile, "plugins")
|
|
||||||
if not ok then
|
|
||||||
hl.exec_cmd("notify-send 'Lua error' '" .. tostring(err) .. "'")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Import everything else
|
-- Import everything else
|
||||||
require("autoload")
|
require("autoload")
|
||||||
|
|||||||
Reference in New Issue
Block a user