Extract commonality
This commit is contained in:
@@ -1,15 +1,8 @@
|
|||||||
local paths = require("default.hypr.paths")
|
local paths = require("default.hypr.paths")
|
||||||
|
local require_optional = require("default.hypr.require_optional")
|
||||||
local function require_file_if_exists(path, module)
|
|
||||||
local file = io.open(path, "r")
|
|
||||||
if file then
|
|
||||||
file:close()
|
|
||||||
require(module)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- GUM environment variables for styling purposes.
|
-- GUM environment variables for styling purposes.
|
||||||
require_file_if_exists(paths.config_home .. "/omarchy/current/theme/gum_env.lua", "omarchy.current.theme.gum_env")
|
require_optional.module("omarchy.current.theme.gum_env")
|
||||||
|
|
||||||
-- Cursor size.
|
-- Cursor size.
|
||||||
hl.env("XCURSOR_SIZE", "24")
|
hl.env("XCURSOR_SIZE", "24")
|
||||||
|
|||||||
@@ -14,11 +14,4 @@ require("default.hypr.input")
|
|||||||
require("default.hypr.windows")
|
require("default.hypr.windows")
|
||||||
|
|
||||||
-- Current theme overrides.
|
-- Current theme overrides.
|
||||||
do
|
require("default.hypr.require_optional").module("omarchy.current.theme.hyprland")
|
||||||
local paths = require("default.hypr.paths")
|
|
||||||
local theme = io.open(paths.config_home .. "/omarchy/current/theme/hyprland.lua", "r")
|
|
||||||
if theme then
|
|
||||||
theme:close()
|
|
||||||
require("omarchy.current.theme.hyprland")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
-- Require a module only when it can be found on package.path.
|
||||||
|
-- Errors inside existing modules still surface normally.
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.module(module)
|
||||||
|
if package.searchpath(module, package.path) then
|
||||||
|
return require(module)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
Reference in New Issue
Block a user