From 28ba8a4f43423efd3ac8df34f8f05d5a280fc19d Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 14 May 2026 12:35:29 +0200 Subject: [PATCH] hl: make custom stuff optional --- dots/.config/hypr/hyprland.lua | 42 ++++++++++++------- dots/.config/hypr/hyprland/keybinds.lua | 7 +++- dots/.config/hypr/hyprland/lib/init.lua | 2 + .../services/create_custom_config.lua | 4 +- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/dots/.config/hypr/hyprland.lua b/dots/.config/hypr/hyprland.lua index f027f80e1..9e87ce3fb 100644 --- a/dots/.config/hypr/hyprland.lua +++ b/dots/.config/hypr/hyprland.lua @@ -1,26 +1,40 @@ -- This file sources other files in `hyprland` and `custom` folders -- You wanna add your stuff in files in `custom` +-- Internal stuff -- +require("hyprland.lib") +require("hyprland.services") + -- Environment variables -- -require("hyprland/env") -require("custom/env") +require("hyprland.env") +if is_file_exists(HOME .. "/.config/hypr/custom/env.lua") then + require("custom.env") +end --- Defaults -- -require("hyprland/execs") -require("hyprland/general") -require("hyprland/rules") -require("hyprland/colors") -require("hyprland/keybinds") +-- Default configurations -- +require("hyprland.execs") +require("hyprland.general") +require("hyprland.rules") +require("hyprland.colors") +require("hyprland.keybinds") --- Custom -- -require("custom/execs") -require("custom/general") -require("custom/rules") -require("custom/keybinds") +-- Custom configurations -- +if is_file_exists(HOME .. "/.config/hypr/custom/execs.lua") then + require("custom.execs") +end +if is_file_exists(HOME .. "/.config/hypr/custom/general.lua") then + require("custom.general") +end +if is_file_exists(HOME .. "/.config/hypr/custom/rules.lua") then + require("custom.rules") +end +if is_file_exists(HOME .. "/.config/hypr/custom/keybinds.lua") then + require("custom.keybinds") +end -- nwg-displays support: re-add the files if it updates later -- require("workspaces") -- require("monitors") -- Shell overrides -- -require("hyprland/shellOverrides/main") +require("hyprland.shellOverrides.main") diff --git a/dots/.config/hypr/hyprland/keybinds.lua b/dots/.config/hypr/hyprland/keybinds.lua index 570259c44..d6fec3485 100644 --- a/dots/.config/hypr/hyprland/keybinds.lua +++ b/dots/.config/hypr/hyprland/keybinds.lua @@ -1,6 +1,11 @@ require("hyprland.lib") require("hyprland.variables") -require("custom.variables") +if is_file_exists(HOME .. "/.config/hypr/custom/variables.lua") then + require("custom.variables") +end +if is_file_exists(HOME .. "/.config/hypr/custom/keybinds.lua") then + require("custom.keybinds") +end local qsScripts = "$HOME/.config/quickshell/$qsConfig/scripts" local hyprScripts = "$HOME/.config/hypr/hyprland/scripts" diff --git a/dots/.config/hypr/hyprland/lib/init.lua b/dots/.config/hypr/hyprland/lib/init.lua index 1ef84f1a7..a82154290 100644 --- a/dots/.config/hypr/hyprland/lib/init.lua +++ b/dots/.config/hypr/hyprland/lib/init.lua @@ -1,3 +1,5 @@ +HOME = os.getenv("HOME") + function is_file_exists(name) local f = io.open(name, "r") if f ~= nil then diff --git a/dots/.config/hypr/hyprland/services/create_custom_config.lua b/dots/.config/hypr/hyprland/services/create_custom_config.lua index a73a083dd..119c8f46c 100644 --- a/dots/.config/hypr/hyprland/services/create_custom_config.lua +++ b/dots/.config/hypr/hyprland/services/create_custom_config.lua @@ -23,7 +23,7 @@ hl.on("hyprland.start", function() end if createdFiles > 0 then - hl.exec_cmd("notify-send 'Hyprland config' 'Created " .. createdFiles .. " custom Hyprland config files in " .. baseCustomDir .. "' -a 'Hyprland'") - hl.exec_cmd("hyprctl reload") + -- hl.exec_cmd("notify-send 'Hyprland config' 'Created " .. createdFiles .. " custom Hyprland config files in " .. baseCustomDir .. "' -a 'Hyprland'") + -- hl.exec_cmd("hyprctl reload") end end)