dotfiles

My PC Dotfiles & Website

modules/gui/gtk.nix (1789B)


 1## GTK Configuration ##
 2{config, ...}: let
 3  inherit (config.flake) files;
 4in {
 5  flake.modules = {
 6    nixos.gtk = {pkgs, ...}: {
 7      # Environment Setup
 8      programs.dconf.enable = true;
 9      services.dbus.packages = [pkgs.dconf];
10      environment = {
11        systemPackages = [pkgs.adw-gtk3];
12        variables."GTK_THEME" = "adw-gtk3-dark";
13      };
14    };
15
16    homeManager.gtk = {
17      config,
18      lib,
19      pkgs,
20      osConfig ? null,
21      ...
22    }:
23      lib.mkIf (osConfig != null) {
24        home = {
25          # Configuration
26          persist.directories = [
27            ".config/dconf"
28            ".config/gtk-3.0"
29            ".config/gtk-4.0"
30          ];
31
32          # Bookmarks
33          file.".config/gtk-3.0/bookmarks" = {
34            text = files.bookmarks;
35            force = true;
36          };
37        };
38
39        # Theming
40        gui._unmanaged = ["gtk"];
41        dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
42        gtk = let
43          theme = {
44            name = "adw-gtk3-dark";
45            package = pkgs.adw-gtk3;
46          };
47        in {
48          enable = true;
49          inherit theme;
50          cursorTheme = config.stylix.cursor;
51          font = with config.stylix.fonts; {
52            inherit (sansSerif) package name;
53            size = sizes.applications;
54          };
55
56          gtk3.extraConfig.gtk-application-prefer-dark-theme = 1;
57          gtk4 = {
58            inherit theme;
59            extraConfig = {
60              gtk-application-prefer-dark-theme = 1;
61
62              # Font Render
63              gtk-hint-font-metrics = 1;
64              gtk-xft-hinting = 1;
65              gtk-xft-hintstyle = "hintslight";
66              gtk-xft-rgba = "rgb";
67            };
68          };
69        };
70      };
71  };
72}