{ 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/${themeName}" = { source = "${sources.fcitx5}/${themeName}"; recursive = true; }; xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply { text = lib.generators.toINIWithGlobalSection {} { globalSection.Theme = themeName; }; }; }; }