Fcitx5: Difference between revisions

Setup: update option names
Jasi (talk | contribs)
m Change addon to add-ons for consistency
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Fcitx5 is a lightweight input method framework with addon support.
[https://fcitx-im.org/wiki/Fcitx_5 Fcitx5] is a lightweight input method framework with add-on support.


== Setup ==
== Installation ==
The following is a simple NixOS configuration that sets up fcitx5, its GUI config tool, and two addons.<syntaxhighlight lang="nix">
 
i18n.inputMethod = {
=== System Setup ===
  enable = true;
 
  type = "fcitx5";
The following is a snippet for a NixOS configuration that sets up fcitx5, its GUI config tool, and two add-ons.
  fcitx5.addons = with pkgs; [ fcitx5-mozc fcitx5-gtk ];
{{File|3={
  i18n.inputMethod = {
    enable = true;
    type = "fcitx5";
    fcitx5.addons = with pkgs; [
      fcitx5-mozc
      fcitx5-gtk
    ];
  };
}|name=/etc/nixos/configuration.nix|lang=nix}}
 
== Configuration ==
Fcitx5 can be configured declaratively (though this is <strong>optional</strong>) using {{nixos:option|i18n.inputMethod.fcitx5.settings}} or [https://home-manager-options.extranix.com/?query=i18n.inputMethod.fcitx5.settings i18n.inputMethod.fcitx5.settings] ([[Home Manager]]). The former generates a config file in {{ic|/etc/xdg/fcitx5}} and the latter in {{ic|~/.config/fcitx5}}.
 
It would be easier to edit the Fcitx5 profile through GUI tools (i.e. {{nixos:package|kdePackages.fcitx5-configtool}}) [https://wiki.archlinux.org/title/Fcitx5#Configuration_tool as recommended in Arch Wiki], then convert the generated configuration files to Nix configuration;
 
* {{ic|cat ~/.config/fcitx5/profile}} (if exists) to {{ic|i18n.inputMethod.fcitx5.settings.inputMethod}}
* {{ic|cat ~/.config/fcitx5/config}} (if exists) to {{ic|i18n.inputMethod.fcitx5.settings.globalOptions}}
 
{{file|configuration.nix or home.nix|nix|3=
i18n.inputMethod.fcitx5.settings.inputMethod = {
  GroupOrder."0" = "Default";
  "Groups/0" = {
    Name = "Default";
    "Default Layout" = "jp";
    DefaultIM = "mozc";
  };
  "Groups/0/Items/0".Name = "keyboard-jp";
  "Groups/0/Items/1".Name = "mozc";
};
};
</syntaxhighlight>Notably, NixOS automagically sets session variables that are required for fcitx5.  
# i18n.inputMethod.fcitx5.settings.globalOptions = { };
 
# If not using Home Manager, you may want to ignore your local config at ~/.config/fcitx5 using the following option.
# i18n.inputMethod.fcitx5.ignoreUserConfig = true;
}}


== Troubleshooting ==
== Troubleshooting ==
Line 26: Line 58:
=== Using Wayland ===
=== Using Wayland ===
Set boolean <code>i18n.inputMethod.fcitx5.waylandFrontend</code> to true to suppress warnings about environment variables.
Set boolean <code>i18n.inputMethod.fcitx5.waylandFrontend</code> to true to suppress warnings about environment variables.
For more details on how to correctly set fcitx5 for different compositors and applications, refer to the [https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland fcitx5 wiki].


[[Category:Applications]]
[[Category:Applications]]