From f3c2f5a1796cbba1e1685270cf0f5a66f118ea96 Mon Sep 17 00:00:00 2001 From: Dennis Lonoshchuk Date: Sat, 30 Nov 2024 10:51:29 -0800 Subject: [PATCH] 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 --- stylix/hm/default.nix | 1 + stylix/hm/icon.nix | 22 ++++++++++++++++++++++ stylix/icon.nix | 26 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 stylix/hm/icon.nix create mode 100644 stylix/icon.nix diff --git a/stylix/hm/default.nix b/stylix/hm/default.nix index 225ea275..e81e5910 100644 --- a/stylix/hm/default.nix +++ b/stylix/hm/default.nix @@ -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; diff --git a/stylix/hm/icon.nix b/stylix/hm/icon.nix new file mode 100644 index 00000000..c0d9fddb --- /dev/null +++ b/stylix/hm/icon.nix @@ -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 + ]); + }; + }; + }; +} diff --git a/stylix/icon.nix b/stylix/icon.nix new file mode 100644 index 00000000..02dfbcb4 --- /dev/null +++ b/stylix/icon.nix @@ -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; + }; + }; +}