diff --git a/home/themes/gtk.nix b/home/themes/gtk.nix index 131c421..7a3b2c1 100644 --- a/home/themes/gtk.nix +++ b/home/themes/gtk.nix @@ -2,7 +2,6 @@ osConfig, config, pkgs, - lib, ... }: let cfg = osConfig.myOptions.home-manager.theme.gtk; @@ -77,4 +76,10 @@ in { gtk-application-prefer-dark-theme = true; }; }; + + dconf.settings = { + "org/gnome/desktop/interface".gtk-theme = cfg.theme.name; + # For Gnome shell + "org/gnome/shell/extensions/user-theme".name = cfg.theme.name; + }; } diff --git a/home/themes/qt.nix b/home/themes/qt.nix index 0e257a7..c98753d 100644 --- a/home/themes/qt.nix +++ b/home/themes/qt.nix @@ -10,9 +10,13 @@ in { qt = { enable = true; - platformTheme.name = mkIf cfg.forceGtk "gtk"; # just an override for QT_QPA_PLATFORMTHEME, takes "gtk", "gnome", "qtct" or "kde" + # just an override for QT_QPA_PLATFORMTHEME, takes "gtk", "gnome", "qtct" or "kde" + platformTheme.name = + if cfg.forceGtk + then "gtk" + else "qtct"; style = mkIf (!cfg.forceGtk) { - name = cfg.theme.name; + name = "Kvantum"; package = cfg.theme.package; }; }; @@ -35,6 +39,16 @@ in { libsForQt5.qtstyleplugins qt6Packages.qt6gtk2 ]) + + (mkIf (!cfg.forceGtk) [ + # If we're not forcing GTK themes, use Kvantum. + # Kvantum as a library and a program to theme qt applications. + qt6Packages.qtstyleplugin-kvantum + libsForQt5.qtstyleplugin-kvantum + + # Also add the theme package to path just in case + cfg.theme.package + ]) ]; sessionVariables = { @@ -53,5 +67,11 @@ in { # tell calibre to use the dark theme, because the light one hurts my eyes CALIBRE_USE_DARK_PALETTE = "1"; }; + + xdg.configFile = mkIf (!cfg.forceGtk) { + "Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" { + General.theme = cfg.theme.name; + }; + }; }; } diff --git a/options/home/theme.nix b/options/home/theme.nix index a2e76bb..5d23c2a 100644 --- a/options/home/theme.nix +++ b/options/home/theme.nix @@ -62,19 +62,31 @@ in forceGtk = mkOption { type = types.bool; default = false; - description = "Whether to force QT applications to try and use the GTK theme."; + description = '' + Whether to force QT applications to try and use the GTK theme. + + If false, qtct platform theme & Kvantum will be used instead. + ''; }; theme = { name = mkOption { type = types.str; default = "Catppuccin-Mocha-Dark"; - description = "The name for the QT theme package"; + description = '' + The name for the QT theme package. + + This has no effect if forceGtk is set. + ''; }; package = mkOption { type = types.package; - description = "The theme package to be used for QT programs"; + description = '' + The theme package to be used for QT programs. + + This has no effect if forceGtk is set. + ''; default = pkgs.catppuccin-kde.override { flavour = ["mocha"]; accents = ["blue"];