feat(i18n): proper multilingual input

Use fcitx5 to switch between different inputs. Installed mozc-ut for
Japanese input with the bepo layout, as well as fcitx5-chinese to load
table-defined layouts for the IPA/X-SAMPA input method.

Currently, mozc_server and fcitx5 need to be launched by the
compositor (only Hyprland for now), auto-launching from module options
needs to be implemented in the future.
This commit is contained in:
2026-04-27 19:57:23 +02:00
parent 171d635b72
commit f3141d6108
7 changed files with 1719 additions and 13 deletions

View File

@@ -41,6 +41,7 @@
}; };
sound.enable = true; sound.enable = true;
}; };
i18n.input.enable = true;
misc.keymap = "fr-bepo"; misc.keymap = "fr-bepo";
networking = { networking = {
hostname = "gampo"; hostname = "gampo";

View File

@@ -86,6 +86,7 @@
scarlett.enable = true; scarlett.enable = true;
}; };
}; };
i18n.input.enable = true;
misc.keymap = "fr-bepo"; misc.keymap = "fr-bepo";
networking = { networking = {
hostname = "marpa"; hostname = "marpa";

View File

@@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./input.nix
./locale.nix ./locale.nix
]; ];
} }

24
system/i18n/input.nix Normal file
View File

@@ -0,0 +1,24 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.mySystem.i18n.input;
in {
options.mySystem.i18n.input.enable = mkEnableOption "Enable i18n input with fcitx5";
config.i18n.inputMethod = mkIf cfg.enable {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-gtk
fcitx5-mozc-ut # Japanese input support
fcitx5-nord
fcitx5-table-other # X-SAMPA to IPA support
qt6Packages.fcitx5-chinese-addons # allow to load table addons
qt6Packages.fcitx5-configtool
qt6Packages.fcitx5-with-addons
];
};
}

View File

@@ -50,10 +50,13 @@ in {
systemd.enable = false; systemd.enable = false;
importantPrefixes = ["$left" "$right" "$up" "$down" "$menu"]; importantPrefixes = ["$left" "$right" "$up" "$down" "$menu"];
settings = { settings = {
env = [
"XMODIFIERS,@im=fcitx"
"XCURSOR_SIZE,12"
];
input = { input = {
kb_layout = "fr,us"; kb_layout = "fr,us";
kb_variant = "bepo_afnor,"; kb_variant = "bepo_afnor,";
# kb_options = "caps:ctrl_modifier";
numlock_by_default = true; numlock_by_default = true;
follow_mouse = 1; follow_mouse = 1;
touchpad.natural_scroll = false; touchpad.natural_scroll = false;
@@ -106,6 +109,8 @@ in {
"pactl load-module module-switch-on-connect" "pactl load-module module-switch-on-connect"
"${pkgs.mpc}/bin/mpc stop" "${pkgs.mpc}/bin/mpc stop"
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
"${pkgs.mozc}/lib/mozc/mozc_server"
"${pkgs.fcitx5}/bin/fcitx5 -d"
] ]
++ lib.lists.optional (! caelestiaEnabled) "${pkgs.networkmanagerapplet}/bin/nm-applet"; ++ lib.lists.optional (! caelestiaEnabled) "${pkgs.networkmanagerapplet}/bin/nm-applet";
}; };
@@ -170,8 +175,6 @@ in {
bind = SUPER_SHIFT, minus, movetoworkspace, 8 bind = SUPER_SHIFT, minus, movetoworkspace, 8
bind = SUPER_SHIFT, slash, movetoworkspace, 9 bind = SUPER_SHIFT, slash, movetoworkspace, 9
bind = SUPER_SHIFT, asterisk, movetoworkspace, 10 bind = SUPER_SHIFT, asterisk, movetoworkspace, 10
env = XCURSOR_SIZE,12
''; '';
}; };
}; };

1673
users/phundrak/XCompose Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -157,16 +157,19 @@
vcs.jj.signing.enable = true; vcs.jj.signing.enable = true;
}; };
fullDesktop = true; fullDesktop = true;
file."${config.home.homeDirectory}/.ssh/allowed_signers" = { file = {
enable = true; ".XCompose".source = ./XCompose;
text = lib.strings.join "\n" ( "${config.home.homeDirectory}/.ssh/allowed_signers" = {
map (file: let enable = true;
content = lib.strings.trim (builtins.readFile file); text = lib.strings.join "\n" (
parts = lib.strings.splitString " " content; map (file: let
email = lib.lists.last parts; content = lib.strings.trim (builtins.readFile file);
in "${email} namespaces=\"git\" ${content}") parts = lib.strings.splitString " " content;
(lib.filesystem.listFilesRecursive ./keys) email = lib.lists.last parts;
); in "${email} namespaces=\"git\" ${content}")
(lib.filesystem.listFilesRecursive ./keys)
);
};
}; };
}; };