diff --git a/hosts/common/user/configs/gui/btop/default.nix b/hosts/common/user/configs/gui/btop/default.nix index 0248d34..3edc4ef 100644 --- a/hosts/common/user/configs/gui/btop/default.nix +++ b/hosts/common/user/configs/gui/btop/default.nix @@ -15,7 +15,7 @@ theme = { template."${home}/.config/btop/themes/matugen.theme".source = ./theme.theme; - extraConfig = "${ + reloadExtraConfig = "${ lib.meta.getExe ( pkgs.writeShellApplication { name = "reload-btop"; diff --git a/hosts/common/user/configs/gui/gtk/default.nix b/hosts/common/user/configs/gui/gtk/default.nix index c331dd4..a6bc497 100644 --- a/hosts/common/user/configs/gui/gtk/default.nix +++ b/hosts/common/user/configs/gui/gtk/default.nix @@ -57,7 +57,7 @@ in "${home}/.config/gtk-4.0/theme.css".source = ./theme.css; }; - theme.extraConfig = "${ + theme.initExtraConfig = "${ lib.meta.getExe ( pkgs.writeShellApplication { name = "theme-gtk"; diff --git a/hosts/common/user/configs/gui/hyprland/default.nix b/hosts/common/user/configs/gui/hyprland/default.nix index b4160c9..2454383 100644 --- a/hosts/common/user/configs/gui/hyprland/default.nix +++ b/hosts/common/user/configs/gui/hyprland/default.nix @@ -140,7 +140,7 @@ theme = { template."${home}/.config/hypr/theme.conf".source = ./theme.conf; - extraConfig = "${ + reloadExtraConfig = "${ lib.meta.getExe ( pkgs.writeShellApplication { name = "reload-hyprland"; diff --git a/hosts/common/user/configs/gui/kitty/default.nix b/hosts/common/user/configs/gui/kitty/default.nix index 77f9b0a..3b99015 100644 --- a/hosts/common/user/configs/gui/kitty/default.nix +++ b/hosts/common/user/configs/gui/kitty/default.nix @@ -33,7 +33,7 @@ in theme = { template."${home}/.config/kitty/theme.conf".source = ./theme.conf; - extraConfig = "${ + reloadExtraConfig = "${ lib.meta.getExe ( pkgs.writeShellApplication { name = "reload-kitty"; diff --git a/hosts/common/user/configs/gui/swww/default.nix b/hosts/common/user/configs/gui/swww/default.nix index e3cb3d9..f59047e 100644 --- a/hosts/common/user/configs/gui/swww/default.nix +++ b/hosts/common/user/configs/gui/swww/default.nix @@ -63,6 +63,6 @@ in Install.WantedBy = [ "graphical-session.target" ]; }; - theme.extraConfig = lib.mkAfter "${themeSwww} &"; + theme.reloadExtraConfig = "${themeSwww} &"; }; } diff --git a/hosts/common/user/configs/gui/theme/options.nix b/hosts/common/user/configs/gui/theme/options.nix index 3a3bbde..bc29717 100644 --- a/hosts/common/user/configs/gui/theme/options.nix +++ b/hosts/common/user/configs/gui/theme/options.nix @@ -8,25 +8,24 @@ let cfg = config.theme; - activation = pkgs.writeShellApplication { + init = pkgs.writeShellApplication { name = "theme-init"; runtimeInputs = with pkgs; [ matugen ]; - bashOptions = [ - "errexit" - "pipefail" - ]; text = '' matugen image "${cfg.configDir}/wallpaper" \ --type scheme-${cfg.flavour} \ --mode "$(cat "${cfg.configDir}/mode")" \ --contrast ${builtins.toString cfg.contrast} - [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && exit 0 - - ${cfg.extraConfig} + ${cfg.initExtraConfig} ''; }; + reload = pkgs.writeShellApplication { + name = "theme-reload"; + text = cfg.reloadExtraConfig; + }; + theme = pkgs.writeShellApplication { name = "theme"; runtimeInputs = with pkgs; [ coreutils ]; @@ -34,7 +33,8 @@ let CONFIG = cfg.configDir; DEFAULT_WALLPAPER = cfg.wallpaper; DEFAULT_MODE = cfg.mode; - ACTIVATION = lib.meta.getExe activation; + INIT = lib.meta.getExe init; + RELOAD = lib.meta.getExe reload; }; text = builtins.readFile ./theme.sh; }; @@ -65,7 +65,13 @@ in description = "The package containing the `theme` script"; }; - extraConfig = mkOption { + initExtraConfig = mkOption { + type = lines; + default = ""; + description = "Extra configuration lines to add to the theme initialization script."; + }; + + reloadExtraConfig = mkOption { type = lines; default = ""; description = "Extra configuration lines to add to the theme reload script."; @@ -416,7 +422,8 @@ in home = { activation.themeInit = inputs.home-manager.lib.hm.dag.entryAfter [ "writeBoundary" - ] "run ${lib.meta.getExe activation}"; + "dconfSettings" + ] "run ${lib.meta.getExe init}"; packages = with pkgs; diff --git a/hosts/common/user/configs/gui/theme/theme.sh b/hosts/common/user/configs/gui/theme/theme.sh index adf8cea..bbbe1fc 100644 --- a/hosts/common/user/configs/gui/theme/theme.sh +++ b/hosts/common/user/configs/gui/theme/theme.sh @@ -38,7 +38,8 @@ finish() { [[ -n "${WALLPAPER}" ]] && ln -sf "${WALLPAPER}" "${CONFIG}"/wallpaper [[ -n "${MODE}" ]] && echo "${MODE}" > "${CONFIG}"/mode - "${ACTIVATION}" > /dev/null + "${INIT}" > /dev/null + "${RELOAD}" > /dev/null } if [[ $# -eq 0 ]]; then