diff options
author | Kaiden Fey <kookie@spacekookie.de> | 2020-09-21 14:12:32 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-09-21 14:12:32 +0200 |
commit | f80843dd45d7acd563d0a5b014cec3a2ea686fc2 (patch) | |
tree | 87189d873d6f932d85f9c1a480462b37d96cd6a5 /home-manager/modules/xresources.nix | |
parent | e0800985dab8f8ebb4cebdfd7e361fd1fafdb2a7 (diff) | |
parent | 9b1b55ba0264a55add4b7b4e022bdc2832b531f6 (diff) |
Merge commit '9b1b55ba0264a55add4b7b4e022bdc2832b531f6'
Diffstat (limited to 'home-manager/modules/xresources.nix')
-rw-r--r-- | home-manager/modules/xresources.nix | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/home-manager/modules/xresources.nix b/home-manager/modules/xresources.nix index b74d671befb..dc59e50c46e 100644 --- a/home-manager/modules/xresources.nix +++ b/home-manager/modules/xresources.nix @@ -28,7 +28,11 @@ in { options = { xresources.properties = mkOption { - type = types.nullOr types.attrs; + type = with types; + let + prim = either bool (either int str); + entry = either prim (listOf prim); + in nullOr (attrsOf entry); default = null; example = literalExample '' { @@ -71,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 + ''; + }; }; - }; } |