Extract commonality

This commit is contained in:
David Heinemeier Hansson
2026-05-19 22:13:09 +02:00
parent 4f41a6c4fd
commit 42f03655df
3 changed files with 15 additions and 17 deletions
+2 -9
View File
@@ -1,15 +1,8 @@
local paths = require("default.hypr.paths")
local function require_file_if_exists(path, module)
local file = io.open(path, "r")
if file then
file:close()
require(module)
end
end
local require_optional = require("default.hypr.require_optional")
-- 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.
hl.env("XCURSOR_SIZE", "24")
+1 -8
View File
@@ -14,11 +14,4 @@ require("default.hypr.input")
require("default.hypr.windows")
-- Current theme overrides.
do
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
require("default.hypr.require_optional").module("omarchy.current.theme.hyprland")
+12
View File
@@ -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