feat(home-manager): add apply option for fcitx5 (#144)

This commit is contained in:
Jens Gatzweiler 2024-05-13 22:28:32 +02:00 committed by GitHub
parent deff55c902
commit 7bf0166443
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,7 +9,16 @@ let
enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5";
in
{
options.i18n.inputMethod.fcitx5.catppuccin = ctp.mkCatppuccinOpt "Fcitx5";
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 = [
@ -21,8 +30,10 @@ in
recursive = true;
};
xdg.configFile."fcitx5/conf/classicui.conf".text = lib.generators.toINIWithGlobalSection { } {
xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply ({
text = lib.generators.toINIWithGlobalSection { } {
globalSection.Theme = "catppuccin-${cfg.flavour}";
};
});
};
}