From afee8c67139dceb246dae1da675dae13f0e0f0a3 Mon Sep 17 00:00:00 2001 From: Anomalocaridid <29845794+Anomalocaridid@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:51:50 -0400 Subject: [PATCH] feat(home-manager): add support for freetube --- modules/home-manager/all-modules.nix | 1 + modules/home-manager/freetube.nix | 25 +++++++++++++++++++++++++ tests/home.nix | 1 + 3 files changed, 27 insertions(+) create mode 100644 modules/home-manager/freetube.nix diff --git a/modules/home-manager/all-modules.nix b/modules/home-manager/all-modules.nix index 0d30f02b..8b92e639 100644 --- a/modules/home-manager/all-modules.nix +++ b/modules/home-manager/all-modules.nix @@ -10,6 +10,7 @@ ./fcitx5.nix ./fish.nix ./foot.nix + ./freetube.nix ./fuzzel.nix ./fzf.nix ./gh-dash.nix diff --git a/modules/home-manager/freetube.nix b/modules/home-manager/freetube.nix new file mode 100644 index 00000000..704dc1f4 --- /dev/null +++ b/modules/home-manager/freetube.nix @@ -0,0 +1,25 @@ +{ config, lib, ... }: +let + inherit (config.programs.freetube.settings) baseTheme; + inherit (lib.ctp) mkAccentOpt mkUpper; + cfg = config.programs.freetube.catppuccin; + enable = cfg.enable && config.programs.freetube.enable; +in +{ + options.programs.freetube.catppuccin = lib.ctp.mkCatppuccinOpt { name = "freetube"; } // { + accent = mkAccentOpt "FreeTube"; + # FreeTube supports two accent colors + secondaryAccent = mkAccentOpt "FreeTube" // { + # Have the secondary accent default to FreeTube's main accent rather than the global Catppuccin accent + # This assumes most users would prefer both accent colors to be the same when only overriding the main one + default = cfg.accent; + }; + }; + + config.programs.freetube.settings = lib.mkIf enable { + # NOTE: For some reason, baseTheme does not capitalize first letter, but the other settings do + baseTheme = "catppuccin${mkUpper cfg.flavor}"; + mainColor = mkUpper "${baseTheme}${mkUpper cfg.accent}"; + secColor = mkUpper "${baseTheme}${mkUpper cfg.secondaryAccent}"; + }; +} diff --git a/tests/home.nix b/tests/home.nix index 004ceced..6dc2c6c3 100644 --- a/tests/home.nix +++ b/tests/home.nix @@ -24,6 +24,7 @@ cava.enable = true; fish.enable = true; foot.enable = true; + freetube.enable = true; fuzzel.enable = true; fzf.enable = true; gh-dash.enable = true;