diff options
author | Robert Helgesson <robert@rycee.net> | 2020-06-28 00:41:05 +0200 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-06-28 00:41:05 +0200 |
commit | 600f39f966459e571c881f0e4f4af16b4eb16329 (patch) | |
tree | dc1e8f1ca62b93060da4d77f4a40bf99831d2b34 /modules | |
parent | a94c8b072e08b11bd9a2462b741f8d3b673ec690 (diff) |
xresources: do not generate file for empty properties
Diffstat (limited to 'modules')
-rw-r--r-- | modules/xresources.nix | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/modules/xresources.nix b/modules/xresources.nix index e9e131352a6..dc59e50c46e 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 + ''; + }; }; - }; } |