feat: make fcitx5 systemd service

This commit is contained in:
DACHXY 2025-04-10 12:23:31 +08:00
parent 7aea0a631b
commit 6fddac69d2
5 changed files with 51 additions and 27 deletions

View file

@ -4,5 +4,6 @@
environment.variables = {
ELECTRON_OZONE_PLATFORM_HINT = "auto";
GSETTINGS_SCHEMA_DIR = "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas";
DIRENV_LOG_FORMAT = ""; # Hide direnv log
};
}

View file

@ -1,5 +1,14 @@
{ pkgs, ... }:
{ pkgs, settings, ... }:
let
addons = with pkgs; [
fcitx5-gtk
fcitx5-mozc # Japanese
fcitx5-chinese-addons
fcitx5-rime # Bopomofo
rime-data
];
in
{
i18n.defaultLocale = "en_US.UTF-8";
@ -20,13 +29,24 @@
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-gtk
fcitx5-mozc # Japanese
fcitx5-chinese-addons
fcitx5-rime # Bopomofo
rime-data
];
fcitx5.addons = addons;
};
systemd.user.services.fcitx5 = {
enable = true;
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
description = "Fcitx5 Input Method";
environment = {
GTK_IM_MODULE = "";
XMODIFIERS = "@im=fcitx";
QT_IM_MODULE = "fcitx";
};
serviceConfig = {
Type = "simple";
Restart = "on-failure";
RestartSec = 2;
ExecStart = "/run/current-system/sw/bin/fcitx5";
};
};
}