From 378ac8e01ca2ec542143960b5bad52f69025a8f8 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Wed, 4 Dec 2024 08:39:36 +0100 Subject: [PATCH] modules/theme/gtk: consistent dark theme on gtk --- modules/theme/gtk.nix | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/theme/gtk.nix b/modules/theme/gtk.nix index 4eca901..2df71fe 100644 --- a/modules/theme/gtk.nix +++ b/modules/theme/gtk.nix @@ -1,11 +1,12 @@ { + inputs, config, lib, pkgs, ... }: let inherit (builtins) pathExists; - inherit (lib) mkOption mkEnableOption; + inherit (lib) mkIf mkOption mkEnableOption; inherit (lib.types) package str; cfg = config.theme.gtk; @@ -62,5 +63,26 @@ in { ''; }) ]; + + home-manager.users.nezia = mkIf config.theme.enable (let + scheme = inputs.basix.schemeData.base16.${config.theme.schemeName}; + in { + gtk = rec { + iconTheme = { + inherit (config.theme.gtk.iconTheme) name package; + }; + + theme = { + inherit (config.theme.gtk.theme) name package; + }; + + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = scheme.variant == "dark"; + }; + gtk4.extraConfig = gtk3.extraConfig; + }; + + dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-${scheme.variant}"; + }); }; }