niksos/modules/gui/gtk.nix

76 lines
2.3 KiB
Nix
Raw Normal View History

2023-09-08 16:10:15 +02:00
{
config,
2023-10-13 21:04:24 +02:00
lib,
2023-09-08 16:10:15 +02:00
...
2023-10-13 21:04:24 +02:00
}: with lib; let
cfg = config.myOptions.themes.gtk;
username = config.myOptions.other.system.username;
hmCfg = config.home-manager.users.${username};
2023-10-13 21:04:24 +02:00
in {
options.myOptions.themes.gtk = {
enable = mkEnableOption "enable gtk theming";
name = mkOption {
description = "gtk theme name";
type = types.str;
};
variant = mkOption {
description = "gtk theme variant";
type = types.str;
};
accentColour = mkOption {
description = "accent colour for gtk theme";
type = types.str;
};
package = mkOption {
description = "gtk theme package";
type = types.package;
2023-09-08 16:10:15 +02:00
};
2023-10-13 21:04:24 +02:00
iconTheme = mkOption {
description = "gtk icon theme";
type = with types; submodule {
options = {
name = mkOption {
description = "gtk icon theme name";
type = str;
};
package = mkOption {
description = "gtk icon theme package";
type = package;
};
};
2023-09-08 16:10:15 +02:00
};
};
};
2023-10-13 21:04:24 +02:00
config = mkIf cfg.enable {
home-manager.users.${username} = {
2023-10-13 21:04:24 +02:00
gtk = {
enable = true;
theme = {
inherit (cfg) name;
package = cfg.package.override {
size = "standard";
accents = [ cfg.accentColour ];
inherit (cfg) variant;
tweaks = [ "normal" ];
};
};
iconTheme = {
inherit (cfg.iconTheme) name;
package = cfg.iconTheme.package.override {
accent = cfg.accentColour;
flavor = cfg.variant;
};
};
gtk2 = {
configLocation = "${hmCfg.xdg.configHome}/gtk-2.0/gtkrc";
};
2023-10-13 21:04:24 +02:00
};
home.sessionVariables = {
GTK_THEME = cfg.name;
GTK_USE_PORTAL = "1";
};
2023-09-08 16:10:15 +02:00
};
};
}