From 5c84f02fcfb4fc697f132e90b8b3f9598c809b96 Mon Sep 17 00:00:00 2001 From: Kilian Mio <86004375+Mikilio@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:35:34 +0100 Subject: [PATCH] regreet: respect dark mode and unset extraCss for custom styling (#723) Respect the stylix.polarity option and unset programs.regreet.extraCss to enable custom styling. This partially resolves the "ReGreet not using GTK or cursor theme" [1] issue. [1]: https://github.com/danth/stylix/issues/690 Link: https://github.com/danth/stylix/pull/723 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- modules/regreet/nixos.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/regreet/nixos.nix b/modules/regreet/nixos.nix index ac4b621b..050b57e0 100644 --- a/modules/regreet/nixos.nix +++ b/modules/regreet/nixos.nix @@ -17,7 +17,23 @@ && pkgs.stdenv.hostPlatform.isLinux ) { + warnings = + let + cfg = config.programs.regreet; + in + lib.mkIf + ( + cfg.enable + && + # defined in https://github.com/NixOS/nixpkgs/blob/8f3e1f807051e32d8c95cd12b9b421623850a34d/nixos/modules/programs/regreet.nix#L153 + config.services.greetd.settings.default_session.command + != "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${lib.getExe cfg.package}" + ) + [ + "Stylix is not guaranteed to style regreet correctly when setting a custom command in `services.greetd.settings.default_session.command `. Note that in most cases no variables under `services.greetd` need to be manually set to ensure that ReGreet is functional." + ]; programs.regreet = { + settings.GTK.application_prefer_dark_theme = config.stylix.polarity == "dark"; settings.background = { path = config.stylix.image; fit = @@ -44,10 +60,6 @@ package = pkgs.adw-gtk3; name = "adw-gtk3"; }; - extraCss = config.lib.stylix.colors { - template = ./../gtk/gtk.mustache; - extension = "css"; - }; }; }; }