1{
2 config,
3 pkgs,
4 lib,
5 ...
6}:
7let
8 imcfg = config.i18n.inputMethod;
9 cfg = imcfg.uim;
10in
11{
12 options = {
13
14 i18n.inputMethod.uim = {
15 toolbar = lib.mkOption {
16 type = lib.types.enum [
17 "gtk"
18 "gtk3"
19 "gtk-systray"
20 "gtk3-systray"
21 "qt5"
22 ];
23 default = "gtk";
24 example = "gtk-systray";
25 description = ''
26 selected UIM toolbar.
27 '';
28 };
29 };
30
31 };
32
33 config = lib.mkIf (imcfg.enable && imcfg.type == "uim") {
34 i18n.inputMethod.package = pkgs.uim;
35
36 environment.variables = {
37 GTK_IM_MODULE = "uim";
38 QT_IM_MODULE = "uim";
39 XMODIFIERS = "@im=uim";
40 };
41 services.xserver.displayManager.sessionCommands = ''
42 ${pkgs.uim}/bin/uim-xim &
43 ${pkgs.uim}/bin/uim-toolbar-${cfg.toolbar} &
44 '';
45 };
46}