fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Ilan Joselevichi18n.inputMethod: add module7e2b1a42

master
1.0 KiB45 linesraw
1{ config, pkgs, lib, ... }:
2
3with lib;
4
5let cfg = config.i18n.inputMethod.uim;
6in {
7  options = {
8
9    i18n.inputMethod.uim = {
10      toolbar = mkOption {
11        type = types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ];
12        default = "gtk";
13        example = "gtk-systray";
14        description = ''
15          Selected UIM toolbar.
16        '';
17      };
18    };
19
20  };
21
22  config = mkIf (config.i18n.inputMethod.enabled == "uim") {
23    i18n.inputMethod.package = pkgs.uim;
24
25    home.sessionVariables = {
26      GTK_IM_MODULE = "uim";
27      QT_IM_MODULE = "uim";
28      XMODIFIERS = "@im=uim";
29    };
30
31    systemd.user.services.uim-daemon = {
32      Unit = {
33        Description = "Uim input method editor";
34        PartOf = [ "graphical-session.desktop" ];
35      };
36      Service.ExecStart = toString
37        (pkgs.writeShellScript "start-uim-xim-and-uim-toolbar" ''
38          ${pkgs.uim}/bin/uim-xim &
39          ${pkgs.uim}/bin/uim-toolbar-${cfg.toolbar}
40        '');
41      Install.WantedBy = [ "graphical-session.target" ];
42    };
43  };
44
45}