niksos/modules/services/fcitx/default.nix

117 lines
4 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.myOptions.services.fcitx5;
inherit (config.myOptions.other.system) username;
inherit (lib) mkEnableOption mkIf;
in {
# stolen from https://git.outfoxxed.me/outfoxxed/nixnew/src/branch/master/modules/user/modules/fcitx5
options.myOptions.services.fcitx5.enable = mkEnableOption "fcitx5";
config = mkIf cfg.enable {
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
libsForQt5.fcitx5-qt
];
};
home-manager.users.${username} = {
xdg.configFile = {
"fcitx5/config".text = ''
[Hotkey]
# Enumerate when press trigger key repeatedly
EnumerateWithTriggerKeys=False
# Enumerate Input Method Forward
EnumerateForwardKeys=
# Enumerate Input Method Backward
EnumerateBackwardKeys=
# Skip first input method while enumerating
EnumerateSkipFirst=False
# Enumerate Input Method Group Forward
EnumerateGroupForwardKeys=
# Enumerate Input Method Group Backward
EnumerateGroupBackwardKeys=
# Activate Input Method
ActivateKeys=
# Deactivate Input Method
DeactivateKeys=
# Default Previous page
PrevPage=
# Default Next page
NextPage=
# Default Previous Candidate
PrevCandidate=
# Default Next Candidate
NextCandidate=
# Toggle embedded preedit
TogglePreedit=
[Hotkey/TriggerKeys]
0=Control+grave
[Hotkey/AltTriggerKeys]
0=Shift_L
[Behavior]
# Active By Default
ActiveByDefault=False
# Share Input State
ShareInputState=No
# Show preedit in application
PreeditEnabledByDefault=True
# Show Input Method Information when switch input method
ShowInputMethodInformation=True
# Show Input Method Information when changing focus
showInputMethodInformationWhenFocusIn=False
# Show compact input method information
CompactInputMethodInformation=True
# Show first input method information
ShowFirstInputMethodInformation=True
# Default page size
DefaultPageSize=5
# Override Xkb Option
OverrideXkbOption=False
# Custom Xkb Option
CustomXkbOption=
# Force Enabled Addons
EnabledAddons=
# Force Disabled Addons
DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True
'';
"fcitx5/profile".text = ''
[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=mozc
[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=
[Groups/0/Items/1]
# Name
Name=mozc
# Layout
Layout=
[GroupOrder]
0=Default
'';
};
};
};
}