stylix: set GTK icon theme (#603)

Closes: https://github.com/danth/stylix/issues/458
Link: https://github.com/danth/stylix/pull/603

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Tested-by: Kamron Bhavnagri <kamwithk@tuta.io>
This commit is contained in:
Dennis Lonoshchuk 2024-11-30 10:51:29 -08:00 committed by GitHub
parent 7689e621f8
commit f3c2f5a179
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 0 deletions

View file

@ -11,6 +11,7 @@ in {
../opacity.nix
./cursor.nix
./fonts.nix
./icon.nix
(import ./palette.nix { inherit palette-generator base16; })
(import ../templates.nix inputs)
] ++ autoload;

22
stylix/hm/icon.nix Normal file
View file

@ -0,0 +1,22 @@
{ config, lib, ... }:
let
cfg = config.stylix.iconTheme;
inherit (config.stylix) polarity;
in {
imports = [ ../icon.nix ];
config = lib.mkIf (config.stylix.enable && cfg.enable) {
gtk = {
iconTheme = {
inherit (cfg) package;
name = builtins.head (lib.filter (x: null != x) [
({
inherit (cfg) dark light;
}."${polarity}" or null)
cfg.dark
cfg.light
]);
};
};
};
}

26
stylix/icon.nix Normal file
View file

@ -0,0 +1,26 @@
{ lib, ... }:
{
options.stylix.iconTheme = {
enable = lib.mkOption {
description = "enable/disable icon theming.";
type = lib.types.bool;
default = false;
};
package = lib.mkOption {
description = "Package providing the icon theme.";
type = lib.types.nullOr lib.types.package;
default = null;
};
light = lib.mkOption {
description = "Light icon theme name.";
type = lib.types.nullOr lib.types.str;
default = null;
};
dark = lib.mkOption {
description = "Dark icon theme name.";
type = lib.types.nullOr lib.types.str;
default = null;
};
};
}