1{ config, pkgs, lib, generators, ... }:
2let imcfg = config.i18n.inputMethod;
3in {
4 imports = [
5 (lib.mkRemovedOptionModule [ "i18n" "inputMethod" "kime" "config" ] "Use i18n.inputMethod.kime.* instead")
6 ];
7
8 options.i18n.inputMethod.kime = {
9 daemonModules = lib.mkOption {
10 type = lib.types.listOf (lib.types.enum [ "Xim" "Wayland" "Indicator" ]);
11 default = [ "Xim" "Wayland" "Indicator" ];
12 example = [ "Xim" "Indicator" ];
13 description = lib.mdDoc ''
14 List of enabled daemon modules
15 '';
16 };
17 iconColor = lib.mkOption {
18 type = lib.types.enum [ "Black" "White" ];
19 default = "Black";
20 example = "White";
21 description = lib.mdDoc ''
22 Color of the indicator icon
23 '';
24 };
25 extraConfig = lib.mkOption {
26 type = lib.types.lines;
27 default = "";
28 description = lib.mdDoc ''
29 extra kime configuration. Refer to <https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md> for details on supported values.
30 '';
31 };
32 };
33
34 config = lib.mkIf (imcfg.enabled == "kime") {
35 i18n.inputMethod.package = pkgs.kime;
36
37 environment.variables = {
38 GTK_IM_MODULE = "kime";
39 QT_IM_MODULE = "kime";
40 XMODIFIERS = "@im=kime";
41 };
42
43 environment.etc."xdg/kime/config.yaml".text = ''
44 daemon:
45 modules: [${lib.concatStringsSep "," imcfg.kime.daemonModules}]
46 indicator:
47 icon_color: ${imcfg.kime.iconColor}
48 '' + imcfg.kime.extraConfig;
49 };
50
51 # uses attributes of the linked package
52 meta.buildDocsInSandbox = false;
53}