dotfiles/modules/nixos/graphical/gtk.nix

52 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2023-08-09 02:13:02 +00:00
{ config, pkgs, lib, ... }: {
2023-08-09 02:13:02 +00:00
options = {
gtk.theme = {
name = lib.mkOption {
type = lib.types.str;
description = "Theme name for GTK applications";
};
package = lib.mkOption {
type = lib.types.package;
description = "Theme package for GTK applications";
default = pkgs.gnome-themes-extra;
};
};
};
config = lib.mkIf config.gui.enable {
home-manager.users.${config.user} = {
gtk = let
gtkExtraConfig = {
gtk-application-prefer-dark-theme = config.theme.dark;
};
in {
enable = true;
theme = {
2023-08-09 02:13:02 +00:00
name = config.gtk.theme.name;
package = config.gtk.theme.package;
};
gtk3.extraConfig = gtkExtraConfig;
gtk4.extraConfig = gtkExtraConfig;
};
};
2023-08-09 02:13:02 +00:00
# Required for setting GTK theme (for preferred-color-scheme in browser)
services.dbus.packages = [ pkgs.dconf ];
programs.dconf.enable = true;
# Make the login screen dark
services.xserver.displayManager.lightdm.greeters.gtk.theme = {
2023-08-09 02:13:02 +00:00
name = config.gtk.theme.name;
package = config.gtk.theme.package;
};
2023-08-09 02:13:02 +00:00
environment.sessionVariables = { GTK_THEME = config.gtk.theme.name; };
};
}