aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/xresources.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/xresources.nix')
-rw-r--r--home-manager/modules/xresources.nix31
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
+ '';
+ };
};
- };
}