From 7cc36b7703ccd38f392599a4b1eebf3e4586fc65 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 24 Sep 2018 23:19:54 +0200 Subject: [PATCH] xresources: run `xrdb -merge` on change Fixes #400 --- modules/xresources.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/xresources.nix b/modules/xresources.nix index 7afee8bb..96580f57 100644 --- a/modules/xresources.nix +++ b/modules/xresources.nix @@ -69,10 +69,17 @@ 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"; + 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 + ''; + }; }; }