# modules/home/gtk.nix — shared Gruvpine GTK colours and pixel SVG icons. # The cursor theme files are symlinked from the dotfiles checkout in tools.nix # (modernxp-retro-black for Xcursor, modernxp-retro-black-hyprcursor for # Hyprland), so there is no package to point home.pointerCursor at. { ... }: let theme = import ../_palette.nix; in { flake.homeModules.gtk = { pkgs, lib, ... }: let icons = import ./_icons { inherit pkgs; inherit (theme) palette; }; commonCss = theme.render (builtins.readFile ./gtk/palette.css); in { gtk = { enable = true; iconTheme = { name = "Gruvpine-Pixel"; package = icons; }; cursorTheme = { name = "modernxp-retro-black"; size = 24; }; theme = lib.mkIf (theme.name != "rose-pine") { name = "adw-gtk3-dark"; package = pkgs.adw-gtk3; }; font = { name = "DMMono Nerd Font"; size = 10; }; gtk3.extraCss = commonCss + theme.render (builtins.readFile ./gtk/gtk3.css); gtk4.extraCss = commonCss + theme.render (builtins.readFile ./gtk/gtk4.css); colorScheme = "dark"; # GTK prefer-dark }; # Inherit a complete theme for icons that do not have pixel artwork yet. home.packages = [ pkgs.papirus-icon-theme pkgs.adwaita-icon-theme ]; # Noctalia and other Qt apps should resolve the same icon theme and fonts # as GTK. Import this into user services as well as login shells. qt = { enable = true; platformTheme.name = "gtk3"; }; systemd.user.sessionVariables.QT_QPA_PLATFORMTHEME = "gtk3"; dconf.settings."org/gnome/desktop/interface" = { icon-theme = "Gruvpine-Pixel"; color-scheme = "prefer-dark"; font-name = "DMMono Nerd Font 10"; gtk-theme = lib.mkIf (theme.name != "rose-pine") "adw-gtk3-dark"; }; # Give GTK and Qt the same theme in the standard user icon directory. xdg.dataFile."icons/Gruvpine-Pixel" = { source = "${icons}/share/icons/Gruvpine-Pixel"; # Replace the interim user-rendered theme link on the next Nix activation. force = true; }; # Preserve upstream Exec/Terminal/Categories while fixing its missing icon. xdg.dataFile."applications/rmpc.desktop".source = pkgs.runCommand "rmpc-pixel.desktop" { } '' cp ${pkgs.rmpc}/share/applications/rmpc.desktop "$out" chmod u+w "$out" printf '\nIcon=rmpc\n' >> "$out" ''; home.sessionVariables = { XCURSOR_THEME = "modernxp-retro-black"; XCURSOR_SIZE = "24"; HYPRCURSOR_THEME = "modernxp-retro-black-hyprcursor"; # name from the theme's manifest.hl HYPRCURSOR_SIZE = "24"; }; } ; }