1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-09-21 13:57:31 +02:00

gtk: fix GTK 4 theme being ignored

Haven't dug into any code, but my best guess is GTK 4 ignores it on
purpose since devs campaigned against theming: https://stopthemingmy.app

According to the following link, it's fine for users to do it as long
as they don't expect support from app devs. And the campaign was
against distributions applying custom themes by default.

  https://github.com/GradienceTeam/Gradience/tree/0.4.1#%EF%B8%8F-gradience-stopthemingmyapp-and-adwaita-developers
This commit is contained in:
ThinkChaos 2023-12-16 09:01:19 -05:00 committed by Mikilio
parent f1590a90ea
commit b74e57ea03
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

View file

@ -35,6 +35,8 @@ let
Package providing the theme. This package will be installed Package providing the theme. This package will be installed
to your profile. If `null` then the theme to your profile. If `null` then the theme
is assumed to already be available in your profile. is assumed to already be available in your profile.
For the theme to apply to GTK 4, this option is mandatory.
''; '';
}; };
@ -233,6 +235,15 @@ in {
gtk-cursor-theme-size = cfg.cursorTheme.size; gtk-cursor-theme-size = cfg.cursorTheme.size;
}; };
gtk4Css =
lib.optionalString (cfg.theme != null && cfg.theme.package != null) ''
/**
* GTK 4 reads the theme configured by gtk-theme-name, but ignores it.
* It does however respect user CSS, so import the theme from here.
**/
@import url("file://${cfg.theme.package}/share/themes/${cfg.theme.name}/gtk-4.0/gtk.css");
'' + cfg4.extraCss;
dconfIni = optionalAttrs (cfg.font != null) { dconfIni = optionalAttrs (cfg.font != null) {
font-name = let font-name = let
fontSize = fontSize =
@ -277,8 +288,7 @@ in {
xdg.configFile."gtk-4.0/settings.ini".text = xdg.configFile."gtk-4.0/settings.ini".text =
toGtk3Ini { Settings = gtkIni // cfg4.extraConfig; }; toGtk3Ini { Settings = gtkIni // cfg4.extraConfig; };
xdg.configFile."gtk-4.0/gtk.css" = xdg.configFile."gtk-4.0/gtk.css" = mkIf (gtk4Css != "") { text = gtk4Css; };
mkIf (cfg4.extraCss != "") { text = cfg4.extraCss; };
dconf.settings."org/gnome/desktop/interface" = dconfIni; dconf.settings."org/gnome/desktop/interface" = dconfIni;
}); });