rose-pine-nix/modules/home-manager/fcitx5.nix
seth 28e6d8a18d
feat(modules): add catppuccin.sources option (#129)
* feat(modules): add `catppuccin.sources` option

* refactor(modules)!: nvfetcher -> npins

npins gives us a nicer file to import that is a simple name value pair
of the port and the path in the store. this allows for easier overriding
with the catppuccin.sources option

* fix(modules): ensure default sources are applied to `catppuccin.sources`
2024-05-13 16:33:16 -04:00

40 lines
1 KiB
Nix

{ config
, lib
, ...
}:
let
inherit (lib) ctp;
inherit (config.catppuccin) sources;
cfg = config.i18n.inputMethod.fcitx5.catppuccin;
enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5";
in
{
options.i18n.inputMethod.fcitx5.catppuccin = ctp.mkCatppuccinOpt "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 {
assertions = [
(ctp.assertXdgEnabled "Fcitx5")
];
xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavour}" = {
source = "${sources.fcitx5}/src/catppuccin-${cfg.flavour}";
recursive = true;
};
xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply ({
text = lib.generators.toINIWithGlobalSection { } {
globalSection.Theme = "catppuccin-${cfg.flavour}";
};
});
};
}