home/fcitx5: use home-manager module options for config

This commit is contained in:
2025-08-23 15:34:16 +02:00
parent dd37bdc08a
commit 6916515737

View File

@@ -8,6 +8,7 @@ in
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
waylandFrontend = true;
addons = with pkgs; [
@@ -15,16 +16,12 @@ in
fcitx5-gtk
# fcitx5-chinese-addons
];
};
};
xdg.configFile = let
format = pkgs.formats.iniWithGlobalSection { };
in {
"fcitx5/profile" = {
force = true;
source = format.generate "fcitx5-profile" {
sections = {
# TODO: fix logic upstream
themes."Material-Color".theme = (builtins.readFile "${pkgs.fcitx5-material-color}/share/fcitx5/themes/Material-Color-orange/theme.conf");
settings = {
inputMethod = {
"Groups/0" = {
Name = "Default";
"Default Layout" = "us";
@@ -46,11 +43,8 @@ in
"0" = "Default";
};
};
};
};
"fcitx5/config".source = format.generate "fcitx5-config" {
sections = {
globalOptions = {
Hotkey = {
# Enumerate when press trigger key repeatedly
EnumerateWithTriggerKeys = "True";
@@ -115,10 +109,8 @@ in
AutoSavePeriod = 30;
};
};
};
"fcitx5/conf/classicui.conf".source = format.generate "fcitx5-classicui.conf" {
globalSection = {
addons.classicui.globalSection = {
Theme = "Material-Color";
PerScreenDPI = "True";
# Font = "";
@@ -126,13 +118,9 @@ in
};
};
};
xdg.dataFile."fcitx5/themes/Material-Color" = {
recursive = true;
source = "${pkgs.fcitx5-material-color}/share/fcitx5/themes/Material-Color-orange";
};
systemd.user.services.fcitx5-daemon = {
systemd.user.services.fcitx5-daemon = lib.mkIf (im.enable && im.type == "fcitx5") {
Service.Restart="on-failure";
Service.ExecStart = lib.mkForce "${fcitx5Package}/bin/fcitx5";
Service.ExecReload = "/bin/kill -HUP $MAINPID";