diff --git a/modules/xresources.nix b/modules/xresources.nix index e9e13135..dc59e50c 100644 --- a/modules/xresources.nix +++ b/modules/xresources.nix @@ -75,17 +75,18 @@ in { }; }; - config = mkIf (cfg.properties != null || cfg.extraConfig != "") { - home.file.".Xresources" = { - text = concatStringsSep "\n" ([ ] - ++ optional (cfg.extraConfig != "") cfg.extraConfig - ++ optionals (cfg.properties != null) - (mapAttrsToList formatLine cfg.properties)) + "\n"; - onChange = '' - if [[ -v DISPLAY ]] ; then - $DRY_RUN_CMD ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources - fi - ''; + config = mkIf ((cfg.properties != null && cfg.properties != { }) + || cfg.extraConfig != "") { + home.file.".Xresources" = { + text = concatStringsSep "\n" ([ ] + ++ optional (cfg.extraConfig != "") cfg.extraConfig + ++ optionals (cfg.properties != null) + (mapAttrsToList formatLine cfg.properties)) + "\n"; + onChange = '' + if [[ -v DISPLAY ]] ; then + $DRY_RUN_CMD ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources + fi + ''; + }; }; - }; } diff --git a/tests/modules/xresources/default.nix b/tests/modules/xresources/default.nix index afd15fbd..70b3e6b4 100644 --- a/tests/modules/xresources/default.nix +++ b/tests/modules/xresources/default.nix @@ -1 +1,4 @@ -{ xresources = ./xresources.nix; } +{ + xresources = ./xresources.nix; + xresources-empty-properties = ./empty.nix; +}