From 3d49b8d15892409bfda3dd59d0ef01276eea1f9f Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:09:43 +0200 Subject: [PATCH] kanshi: dont write config if unnecessary --- modules/services/kanshi.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/services/kanshi.nix b/modules/services/kanshi.nix index 2eda7487629c..f90adf14f9f0 100644 --- a/modules/services/kanshi.nix +++ b/modules/services/kanshi.nix @@ -332,11 +332,13 @@ in { { home.packages = [ cfg.package ]; - xdg.configFile."kanshi/config".text = - if cfg.profiles == { } && cfg.extraConfig == "" then - directivesStr - else - oldDirectivesStr; + xdg.configFile."kanshi/config" = let + generatedConfigStr = + if cfg.profiles == { } && cfg.extraConfig == "" then + directivesStr + else + oldDirectivesStr; + in mkIf (generatedConfigStr != "") { text = generatedConfigStr; }; systemd.user.services.kanshi = { Unit = {