Fix qt theme

This commit is contained in:
ItsDrike 2024-06-23 18:11:45 +02:00
parent d796eea045
commit 6bedfed95c
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
3 changed files with 43 additions and 6 deletions

View file

@ -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;
};
}

View file

@ -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;
};
};
};
}