Commit ff5e38a

HPCesia <me@hpcesia.com>
2026-06-21 09:33:31
Add input method for desktop
1 parent fbca00b
Changed files (2)
modules
desktop
input-method
users
hpcesia
modules/desktop/input-method/fcitx5.nix
@@ -0,0 +1,73 @@
+{
+  den.aspects.desktop.input-method.fcitx5 = {
+    persistHome = {config, ...}: {
+      directories = [
+        "${config.xdg.dataHome}/fcitx5/rime" # RIME data
+      ];
+    };
+
+    homeManager = {
+      osConfig,
+      pkgs,
+      ...
+    }: let
+      fcitx5-rime = pkgs.fcitx5-rime.override {
+        rimeDataPkgs = [pkgs.nur.repos.xddxdd.rime-ice];
+      };
+    in {
+      i18n.inputMethod = {
+        enable = true;
+        type = "fcitx5";
+        fcitx5 = {
+          fcitx5-with-addons = pkgs.qt6Packages.fcitx5-with-addons;
+          addons = with pkgs; [
+            fcitx5-rime
+            fcitx5-gtk # gtk im module
+          ];
+          waylandFrontend = !osConfig.services.xserver.enable;
+          settings = {
+            inputMethod = {
+              GroupOrder."0" = "Default";
+              "Groups/0" = {
+                Name = "Default";
+                "Default Layout" = "us";
+                DefaultIM = "rime";
+              };
+              "Groups/0/Items/0" = {
+                Name = "keyboard-us";
+                Layout = "us";
+              };
+              "Groups/0/Items/1" = {
+                Name = "rime";
+                Layout = "us";
+              };
+            };
+            addons = {
+              rime.globalSection = {
+                PreeditMode = "Composing text";
+                InputState = "All";
+                PreeditCursorPositionAtBeginning = true;
+                SwitchInputMethodBehavior = "Commit commit preview";
+              };
+            };
+          };
+        };
+      };
+    };
+  };
+
+  den.aspects.desktop.input-method.fcitx5.themes = {
+    catppuccin = {
+      homeManager = {pkgs, ...}: {
+        i18n.inputMethod.fcitx5 = {
+          addons = [
+            (pkgs.catppuccin-fcitx5.override {withRoundedCorners = true;})
+          ];
+          settings.addons = {
+            classicui.globalSection.Theme = "catppuccin-mocha-mauve";
+          };
+        };
+      };
+    };
+  };
+}
modules/users/hpcesia/default.nix
@@ -24,6 +24,7 @@
           desktop.env.wm.niri
           desktop.flatpak
           desktop.gnupg
+          desktop.input-method.fcitx5
           desktop.kdeconnect
           desktop.terminal.foot
         ]));