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