From 958844de4c4901683dc890353e878282947c32f9 Mon Sep 17 00:00:00 2001 From: celeri Date: Sat, 4 May 2024 03:29:32 -0400 Subject: [PATCH] feat(home-manager/gtk): add gnome option Add an option to set the gtk theme as gnome shell's theme using the user-theme gnome extension --- modules/home-manager/gtk.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index 74a3f54b..32cb3d0e 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -25,6 +25,11 @@ in default = [ "normal" ]; description = "Catppuccin tweaks for gtk"; }; + gnome = mkOption { + type = lib.types.bool; + default = false; + description = "Wether to use the gtk theme as gnome shell's theme"; + }; cursor = ctp.mkCatppuccinOpt "gtk cursors" // { @@ -79,5 +84,25 @@ in "gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css"; "gtk-4.0/gtk-dark.css".source = "${gtk4Dir}/gtk-dark.css"; }; + + home.packages = lib.mkIf cfg.gnome [pkgs.gnomeExtensions.user-themes]; + + dconf.settings = lib.mkIf cfg.gnome { + "org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = [ + "user-theme@gnome-shell-extensions.gcampax.github.com" + ]; + }; + "org/gnome/shell/extensions/user-theme" = { + name = config.gtk.theme.name; + }; + "org/gnome/desktop/interface" = { + color-scheme = + if cfg.flavour == "latte" + then "default" + else "prefer-dark"; + }; + }; }; }