main
 1{
 2  den.aspects.desktop.input-method.fcitx5 = {
 3    persistHome = {config, ...}: {
 4      directories = [
 5        "${config.xdg.dataHome}/fcitx5/rime" # RIME data
 6      ];
 7    };
 8
 9    homeManager = {
10      osConfig,
11      pkgs,
12      ...
13    }: let
14      fcitx5-rime = pkgs.fcitx5-rime.override {
15        rimeDataPkgs = [pkgs.nur.repos.xddxdd.rime-ice];
16      };
17    in {
18      i18n.inputMethod = {
19        enable = true;
20        type = "fcitx5";
21        fcitx5 = {
22          fcitx5-with-addons = pkgs.qt6Packages.fcitx5-with-addons;
23          addons = with pkgs; [
24            fcitx5-rime
25            fcitx5-gtk # gtk im module
26          ];
27          waylandFrontend = !osConfig.services.xserver.enable;
28          settings = {
29            inputMethod = {
30              GroupOrder."0" = "Default";
31              "Groups/0" = {
32                Name = "Default";
33                "Default Layout" = "us";
34                DefaultIM = "rime";
35              };
36              "Groups/0/Items/0" = {
37                Name = "keyboard-us";
38                Layout = "us";
39              };
40              "Groups/0/Items/1" = {
41                Name = "rime";
42                Layout = "us";
43              };
44            };
45            addons = {
46              rime.globalSection = {
47                PreeditMode = "Composing text";
48                InputState = "All";
49                PreeditCursorPositionAtBeginning = true;
50                SwitchInputMethodBehavior = "Commit commit preview";
51              };
52            };
53          };
54        };
55      };
56    };
57  };
58
59  den.aspects.desktop.input-method.fcitx5.themes = {
60    catppuccin = {
61      homeManager = {pkgs, ...}: {
62        i18n.inputMethod.fcitx5 = {
63          addons = [
64            (pkgs.catppuccin-fcitx5.override {withRoundedCorners = true;})
65          ];
66          settings.addons = {
67            classicui.globalSection.Theme = "catppuccin-mocha-mauve";
68          };
69        };
70      };
71    };
72  };
73}