From 4fee4bd14b5e4178855ad0041df89fa44f3f2bea Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 6 Jan 2026 21:17:38 +0100 Subject: [PATCH] ghostty: reload service on configuration change --- modules/programs/ghostty.nix | 9 ++++++ .../programs/ghostty/systemd-service.nix | 30 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/modules/programs/ghostty.nix b/modules/programs/ghostty.nix index a8102a5a5..152df981f 100644 --- a/modules/programs/ghostty.nix +++ b/modules/programs/ghostty.nix @@ -231,6 +231,15 @@ in xdg.configFile."systemd/user/app-com.mitchellh.ghostty.service.d/overrides.conf".text = '' [Unit] X-SwitchMethod=keep-old + X-Reload-Triggers=${ + let + storePathOf = name: config.xdg.configFile.${name}.source; + in + toString ( + lib.optionals (cfg.settings != { }) [ (storePathOf "ghostty/config") ] + ++ lib.mapAttrsToList (name: _: storePathOf "ghostty/themes/${name}") cfg.themes + ) + } ''; dbus.packages = [ cfg.package ]; diff --git a/tests/modules/programs/ghostty/systemd-service.nix b/tests/modules/programs/ghostty/systemd-service.nix index 6efaa9025..ba6e1ff0b 100644 --- a/tests/modules/programs/ghostty/systemd-service.nix +++ b/tests/modules/programs/ghostty/systemd-service.nix @@ -8,6 +8,33 @@ theme = "catppuccin-mocha"; font-size = 10; }; + themes = { + catppuccin-mocha = { + palette = [ + "0=#45475a" + "1=#f38ba8" + "2=#a6e3a1" + "3=#f9e2af" + "4=#89b4fa" + "5=#f5c2e7" + "6=#94e2d5" + "7=#bac2de" + "8=#585b70" + "9=#f38ba8" + "10=#a6e3a1" + "11=#f9e2af" + "12=#89b4fa" + "13=#f5c2e7" + "14=#94e2d5" + "15=#a6adc8" + ]; + background = "1e1e2e"; + foreground = "cdd6f4"; + cursor-color = "f5e0dc"; + selection-background = "353749"; + selection-foreground = "cdd6f4"; + }; + }; }; nmt.script = '' @@ -15,10 +42,11 @@ serviceOverridesPath=$servicePath.d/overrides.conf assertFileExists $serviceOverridesPath - assertFileContent $serviceOverridesPath \ + assertFileContent $(normalizeStorePaths $serviceOverridesPath) \ ${builtins.toFile "ghostty-service-overrides" '' [Unit] X-SwitchMethod=keep-old + X-Reload-Triggers=/nix/store/00000000000000000000000000000000-ghostty-config /nix/store/00000000000000000000000000000000-ghostty-catppuccin-mocha-theme ''} assertFileContent \