nichts/modules/gui/gtk.nix

66 lines
1.8 KiB
Nix
Raw Normal View History

2024-04-10 17:39:26 +02:00
{
config,
lib,
...
}: with lib; let
2024-04-12 22:03:29 +02:00
cfg = config.modules.themes.gtk;
username = config.modules.other.system.username;
2024-04-10 17:39:26 +02:00
hmCfg = config.home-manager.users.${username};
in {
2024-04-12 22:03:29 +02:00
options.modules.themes.gtk = {
2024-04-10 17:39:26 +02:00
enable = mkEnableOption "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;
};
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;
};
};
};
};
};
config = mkIf cfg.enable {
home-manager.users.${username} = {
gtk = {
enable = true;
theme = {
2024-04-29 22:18:58 +02:00
inherit (cfg) name package;
2024-04-10 17:39:26 +02:00
};
iconTheme = {
2024-04-29 22:18:58 +02:00
inherit (cfg.iconTheme) name package;
2024-04-10 17:39:26 +02:00
};
gtk2 = {
configLocation = "${hmCfg.xdg.configHome}/gtk-2.0/gtkrc";
};
};
home.sessionVariables = {
GTK_THEME = cfg.name;
GTK_USE_PORTAL = "1";
};
};
};
}