From 9479745881253c5a6991c36c498d6c2395841da3 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 19 Oct 2024 19:48:53 -0700 Subject: [PATCH] feat(fcitx5): Catppuccin -> Rose Pine --- .sources/sources.json | 8 +++--- modules/home-manager/fcitx5.nix | 46 +++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.sources/sources.json b/.sources/sources.json index 2f3abf0..95b5e70 100644 --- a/.sources/sources.json +++ b/.sources/sources.json @@ -88,13 +88,13 @@ "type": "Git", "repository": { "type": "GitHub", - "owner": "catppuccin", + "owner": "rose-pine", "repo": "fcitx5" }, "branch": "main", - "revision": "3471b918d4b5aab2d3c3dd9f2c3b9c18fb470e8e", - "url": "https://github.com/catppuccin/fcitx5/archive/3471b918d4b5aab2d3c3dd9f2c3b9c18fb470e8e.tar.gz", - "hash": "0rsyrwc74pif9x0f5l3d9bb0s4van0py8qis6qr3zsqq65aqb2nl" + "revision": "148de09929c2e2f948376bb23bc25d72006403bc", + "url": "https://github.com/rose-pine/fcitx5/archive/148de09929c2e2f948376bb23bc25d72006403bc.tar.gz", + "hash": "0gywb8ykb2j3zyr20w1mc3f5xfw2aw4v9b821d55w36ja753k52a" }, "fish": { "type": "Git", diff --git a/modules/home-manager/fcitx5.nix b/modules/home-manager/fcitx5.nix index e094700..a050ab1 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -1,30 +1,38 @@ -{ config, lib, ... }: -let - inherit (config.catppuccin) sources; - cfg = config.i18n.inputMethod.fcitx5.catppuccin; - enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; -in { - options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // { - apply = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`. - If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`). - ''; + config, + lib, + ... +}: let + inherit (config.rose-pine) sources; + cfg = config.i18n.inputMethod.fcitx5.rose-pine; + enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; + themeName = + if (cfg.flavor == "main") + then "rose-pine" + else "rose-pine-${cfg.flavor}"; +in { + options.i18n.inputMethod.fcitx5.rose-pine = + lib.rp.mkRosePineOpt {name = "Fcitx5";} + // { + apply = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`. + If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`). + ''; + }; }; - }; config = lib.mkIf enable { - xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavor}" = { - source = "${sources.fcitx5}/src/catppuccin-${cfg.flavor}"; + xdg.dataFile."fcitx5/themes/${themeName}" = { + source = "${sources.fcitx5}/${themeName}"; recursive = true; }; xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply { - text = lib.generators.toINIWithGlobalSection { } { - globalSection.Theme = "catppuccin-${cfg.flavor}"; + text = lib.generators.toINIWithGlobalSection {} { + globalSection.Theme = themeName; }; }; };