Modules/Fcitx: Move fcitx5 configuration to new module
This commit is contained in:
@ -16,6 +16,10 @@
|
|||||||
modules = {
|
modules = {
|
||||||
btop.cuda = true;
|
btop.cuda = true;
|
||||||
|
|
||||||
|
# This has been relocated here from the default config,
|
||||||
|
# because it forces en-US keyboard layout.
|
||||||
|
fcitx.enable = true;
|
||||||
|
|
||||||
hyprland = {
|
hyprland = {
|
||||||
kb-layout = "us";
|
kb-layout = "us";
|
||||||
kb-variant = "altgr-intl";
|
kb-variant = "altgr-intl";
|
||||||
@ -242,606 +246,5 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# This has been relocated here from the default config,
|
|
||||||
# because it forces en-US keyboard layout.
|
|
||||||
i18n.inputMethod = {
|
|
||||||
enable = true;
|
|
||||||
type = "fcitx5";
|
|
||||||
|
|
||||||
fcitx5 = {
|
|
||||||
waylandFrontend = true;
|
|
||||||
|
|
||||||
addons = with pkgs; [
|
|
||||||
fcitx5-gtk
|
|
||||||
# fcitx5-configtool
|
|
||||||
catppuccin-fcitx5
|
|
||||||
|
|
||||||
libsForQt5.fcitx5-qt # QT5
|
|
||||||
libsForQt5.fcitx5-chinese-addons
|
|
||||||
|
|
||||||
qt6Packages.fcitx5-qt # QT6
|
|
||||||
qt6Packages.fcitx5-chinese-addons
|
|
||||||
];
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
inputMethod = {
|
|
||||||
GroupOrder = {
|
|
||||||
"0" = "Default";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Groups/0" = {
|
|
||||||
# Group Name
|
|
||||||
Name = "Default";
|
|
||||||
|
|
||||||
# Layout
|
|
||||||
"Default Layout" = "us";
|
|
||||||
|
|
||||||
# Default Input Method
|
|
||||||
DefaultIM = "pinyin";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Groups/0/Items/0" = {
|
|
||||||
# Name
|
|
||||||
Name = "keyboard-us";
|
|
||||||
|
|
||||||
# Layout
|
|
||||||
# Layout=
|
|
||||||
};
|
|
||||||
|
|
||||||
"Groups/0/Items/1" = {
|
|
||||||
# Name
|
|
||||||
Name = "pinyin";
|
|
||||||
|
|
||||||
# Layout
|
|
||||||
# Layout=
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
globalOptions = {
|
|
||||||
Hotkey = {
|
|
||||||
# Enumerate when press trigger key repeatedly
|
|
||||||
EnumerateWithTriggerKeys = true;
|
|
||||||
|
|
||||||
# Temporally switch between first and current Input Method
|
|
||||||
# AltTriggerKeys=
|
|
||||||
|
|
||||||
# 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=
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hotkey/TriggerKeys" = {
|
|
||||||
"0" = "Super+space";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hotkey/PrevPage" = {
|
|
||||||
"0" = "Up";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hotkey/NextPage" = {
|
|
||||||
"0" = "Down";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hotkey/PrevCandidate" = {
|
|
||||||
"0" = "Shift+Tab";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hotkey/NextCandidate" = {
|
|
||||||
"0" = "Tab";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hotkey/TogglePreedit" = {
|
|
||||||
"0" = "Control+Alt+P";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Behavior" = {
|
|
||||||
# Active By Default
|
|
||||||
ActiveByDefault = false;
|
|
||||||
|
|
||||||
# Reset state on Focus In
|
|
||||||
resetStateWhenFocusIn = "No";
|
|
||||||
|
|
||||||
# Share Input State
|
|
||||||
ShareInputState = "All";
|
|
||||||
|
|
||||||
# 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 = false;
|
|
||||||
|
|
||||||
# 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;
|
|
||||||
|
|
||||||
# Allow input method in the password field
|
|
||||||
AllowInputMethodForPassword = false;
|
|
||||||
|
|
||||||
# Show preedit text when typing password
|
|
||||||
ShowPreeditForPassword = false;
|
|
||||||
|
|
||||||
# Interval of saving user data in minutes
|
|
||||||
AutoSavePeriod = 30;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
addons = {
|
|
||||||
chttrans.globalSection = {
|
|
||||||
# Translate engine
|
|
||||||
Engine = "OpenCC";
|
|
||||||
|
|
||||||
# Toggle key
|
|
||||||
# Hotkey=
|
|
||||||
|
|
||||||
# Enabled Input Methods
|
|
||||||
# EnabledIM=
|
|
||||||
|
|
||||||
# OpenCC profile for Simplified to Traditional
|
|
||||||
# OpenCCS2TProfile=
|
|
||||||
|
|
||||||
# OpenCC profile for Traditional to Simplified
|
|
||||||
# OpenCCT2SProfile=
|
|
||||||
};
|
|
||||||
|
|
||||||
classicui.globalSection = {
|
|
||||||
# Vertical Candidate List
|
|
||||||
"Vertical Candidate List" = false;
|
|
||||||
|
|
||||||
# Use mouse wheel to go to prev or next page
|
|
||||||
WheelForPaging = true;
|
|
||||||
|
|
||||||
# Font
|
|
||||||
Font = "Sans 12";
|
|
||||||
|
|
||||||
# Menu Font
|
|
||||||
MenuFont = "Sans 12";
|
|
||||||
|
|
||||||
# Tray Font
|
|
||||||
TrayFont = "Sans Bold 10";
|
|
||||||
|
|
||||||
# Tray Label Outline Color
|
|
||||||
TrayOutlineColor = "#000000";
|
|
||||||
|
|
||||||
# Tray Label Text Color
|
|
||||||
TrayTextColor = "#ffffff";
|
|
||||||
|
|
||||||
# Prefer Text Icon
|
|
||||||
PreferTextIcon = false;
|
|
||||||
|
|
||||||
# Show Layout Name In Icon
|
|
||||||
ShowLayoutNameInIcon = true;
|
|
||||||
|
|
||||||
# Use input method language to display text
|
|
||||||
UseInputMethodLanguageToDisplayText = true;
|
|
||||||
|
|
||||||
# Theme
|
|
||||||
Theme = "catppuccin-latte-lavender";
|
|
||||||
|
|
||||||
# Dark Theme
|
|
||||||
DarkTheme = "catppuccin-mocha-lavender";
|
|
||||||
|
|
||||||
# Follow system light/dark color scheme
|
|
||||||
UseDarkTheme = true;
|
|
||||||
|
|
||||||
# Follow system accent color if it is supported by theme and desktop
|
|
||||||
UseAccentColor = true;
|
|
||||||
|
|
||||||
# Use Per Screen DPI on X11
|
|
||||||
PerScreenDPI = true;
|
|
||||||
|
|
||||||
# Force font DPI on Wayland
|
|
||||||
ForceWaylandDPI = 0;
|
|
||||||
|
|
||||||
# Enable fractional scale under Wayland
|
|
||||||
EnableFractionalScale = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
clipboard.globalSection = {
|
|
||||||
# Trigger Key
|
|
||||||
# TriggerKey=
|
|
||||||
|
|
||||||
# Paste Primary
|
|
||||||
# PastePrimaryKey=
|
|
||||||
|
|
||||||
# Number of entries
|
|
||||||
"Number of entries" = 5;
|
|
||||||
};
|
|
||||||
|
|
||||||
cloudpinyin.globalSection = {
|
|
||||||
# Minimum Pinyin Length
|
|
||||||
MinimumPinyinLength = 4;
|
|
||||||
|
|
||||||
# Backend
|
|
||||||
Backend = "GoogleCN";
|
|
||||||
|
|
||||||
# Proxy
|
|
||||||
# Proxy=
|
|
||||||
};
|
|
||||||
|
|
||||||
cloudpinyin.sections = {
|
|
||||||
"Toggle Key" = {
|
|
||||||
"0" = "Control+Alt+Shift+C";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
fullwidth.globalSection = {
|
|
||||||
# Toggle key
|
|
||||||
# Hotkey=
|
|
||||||
};
|
|
||||||
|
|
||||||
imselector.globalSection = {
|
|
||||||
# Trigger Key
|
|
||||||
# TriggerKey=
|
|
||||||
|
|
||||||
# Trigger Key for only current input context
|
|
||||||
# TriggerKeyLocal=
|
|
||||||
|
|
||||||
# Hotkey for switching to the N-th input method
|
|
||||||
# SwitchKey=
|
|
||||||
|
|
||||||
# Hotkey for switching to the N-th input method for only current input context
|
|
||||||
# SwitchKeyLocal=
|
|
||||||
};
|
|
||||||
|
|
||||||
keyboard.globalSection = {
|
|
||||||
# Page size
|
|
||||||
PageSize = 5;
|
|
||||||
|
|
||||||
# Enable emoji in hint
|
|
||||||
EnableEmoji = false;
|
|
||||||
|
|
||||||
# Enable emoji in quickphrase
|
|
||||||
EnableQuickPhraseEmoji = false;
|
|
||||||
|
|
||||||
# Choose key modifier
|
|
||||||
"Choose Modifier" = "Alt";
|
|
||||||
|
|
||||||
# Enable hint by default
|
|
||||||
EnableHintByDefault = false;
|
|
||||||
|
|
||||||
# Trigger hint mode for one time
|
|
||||||
# "One Time Hint Trigger"=
|
|
||||||
|
|
||||||
# Use new compose behavior
|
|
||||||
UseNewComposeBehavior = true;
|
|
||||||
|
|
||||||
# Type special characters with long press
|
|
||||||
EnableLongPress = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
keyboard.sections = {
|
|
||||||
"PrevCandidate" = {
|
|
||||||
"0" = "Shift+Tab";
|
|
||||||
};
|
|
||||||
|
|
||||||
"NextCandidate" = {
|
|
||||||
"0" = "Tab";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Hint Trigger" = {
|
|
||||||
"0" = "Control+Alt+H";
|
|
||||||
};
|
|
||||||
|
|
||||||
"LongPressBlocklist" = {
|
|
||||||
"0" = "konsole";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
notifications.globalSection = {
|
|
||||||
# Hidden Notifications
|
|
||||||
# HiddenNotifications=
|
|
||||||
};
|
|
||||||
|
|
||||||
pinyin.globalSection = {
|
|
||||||
# Shuangpin Profile
|
|
||||||
ShuangpinProfile = "Ziranma";
|
|
||||||
|
|
||||||
# Show current shuangpin mode
|
|
||||||
ShowShuangpinMode = true;
|
|
||||||
|
|
||||||
# Page size
|
|
||||||
PageSize = 7;
|
|
||||||
|
|
||||||
# Enable Spell
|
|
||||||
SpellEnabled = false;
|
|
||||||
|
|
||||||
# Enable Symbols
|
|
||||||
SymbolsEnabled = true;
|
|
||||||
|
|
||||||
# Enable Chaizi
|
|
||||||
ChaiziEnabled = false;
|
|
||||||
|
|
||||||
# Enable Characters in Unicode CJK Extension B
|
|
||||||
ExtBEnabled = true;
|
|
||||||
|
|
||||||
# Enable Cloud Pinyin
|
|
||||||
CloudPinyinEnabled = true;
|
|
||||||
|
|
||||||
# Cloud Pinyin Index
|
|
||||||
CloudPinyinIndex = 2;
|
|
||||||
|
|
||||||
# Show animation when Cloud Pinyin is loading
|
|
||||||
CloudPinyinAnimation = true;
|
|
||||||
|
|
||||||
# Always show Cloud Pinyin place holder
|
|
||||||
KeepCloudPinyinPlaceHolder = false;
|
|
||||||
|
|
||||||
# Preedit Mode
|
|
||||||
PreeditMode = "Composing pinyin";
|
|
||||||
|
|
||||||
# Fix embedded preedit cursor at the beginning of the preedit
|
|
||||||
PreeditCursorPositionAtBeginning = true;
|
|
||||||
|
|
||||||
# Show complete pinyin in preedit
|
|
||||||
PinyinInPreedit = false;
|
|
||||||
|
|
||||||
# Enable Prediction
|
|
||||||
Prediction = false;
|
|
||||||
|
|
||||||
# Prediction Size
|
|
||||||
PredictionSize = 10;
|
|
||||||
|
|
||||||
# Action when switching input method
|
|
||||||
SwitchInputMethodBehavior = "Commit current preedit";
|
|
||||||
|
|
||||||
# Forget word
|
|
||||||
# ForgetWord=
|
|
||||||
|
|
||||||
# Select 2nd Candidate
|
|
||||||
# SecondCandidate=
|
|
||||||
|
|
||||||
# Select 3rd Candidate
|
|
||||||
# ThirdCandidate=
|
|
||||||
|
|
||||||
# Use Keypad as Selection key
|
|
||||||
UseKeypadAsSelection = false;
|
|
||||||
|
|
||||||
# Use BackSpace to cancel the selection
|
|
||||||
BackSpaceToUnselect = true;
|
|
||||||
|
|
||||||
# Number of Sentences
|
|
||||||
"Number of sentence" = 2;
|
|
||||||
|
|
||||||
# Prompt long word length when input length over (0 for disable)
|
|
||||||
LongWordLengthLimit = 4;
|
|
||||||
|
|
||||||
# Key to trigger quickphrase
|
|
||||||
# QuickPhraseKey=
|
|
||||||
|
|
||||||
# Use V to trigger quickphrase
|
|
||||||
VAsQuickphrase = false;
|
|
||||||
|
|
||||||
# FirstRun
|
|
||||||
FirstRun = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
pinyin.sections = {
|
|
||||||
"PrevPage" = {
|
|
||||||
"0" = "Up";
|
|
||||||
};
|
|
||||||
|
|
||||||
"NextPage" = {
|
|
||||||
"0" = "Down";
|
|
||||||
};
|
|
||||||
|
|
||||||
"PrevCandidate" = {
|
|
||||||
"0" = "Shift+Tab";
|
|
||||||
};
|
|
||||||
|
|
||||||
"NextCandidate" = {
|
|
||||||
"0" = "Tab";
|
|
||||||
};
|
|
||||||
|
|
||||||
"CurrentCandidate" = {
|
|
||||||
"0" = "space";
|
|
||||||
"1" = "KP_Space";
|
|
||||||
};
|
|
||||||
|
|
||||||
"CommitRawInput" = {
|
|
||||||
"0" = "Return";
|
|
||||||
"1" = "KP_Enter";
|
|
||||||
"2" = "Control+Return";
|
|
||||||
"3" = "Control+KP_Enter";
|
|
||||||
"4" = "Shift+Return";
|
|
||||||
"5" = "Shift+KP_Enter";
|
|
||||||
"6" = "Control+Shift+Return";
|
|
||||||
"7" = "Control+Shift+KP_Enter";
|
|
||||||
};
|
|
||||||
|
|
||||||
"ChooseCharFromPhrase" = {
|
|
||||||
"0" = "bracketleft";
|
|
||||||
"1" = "bracketright";
|
|
||||||
};
|
|
||||||
|
|
||||||
"FilterByStroke" = {
|
|
||||||
"0" = "grave";
|
|
||||||
};
|
|
||||||
|
|
||||||
"QuickPhraseTriggerRegex" = {
|
|
||||||
"0" = ".(/|@)$";
|
|
||||||
"1" = "^(www|bbs|forum|mail|bbs)''.";
|
|
||||||
"2" = "^(http|https|ftp|telnet|mailto):";
|
|
||||||
};
|
|
||||||
|
|
||||||
"Fuzzy" = {
|
|
||||||
# ue -> ve
|
|
||||||
VE_UE = true;
|
|
||||||
|
|
||||||
# Common Typo
|
|
||||||
NG_GN = true;
|
|
||||||
|
|
||||||
# Inner Segment (xian -> xi'an)
|
|
||||||
Inner = true;
|
|
||||||
|
|
||||||
# Inner Segment for Short Pinyin (qie -> qi'e)
|
|
||||||
InnerShort = true;
|
|
||||||
|
|
||||||
# Match partial finals (e -> en, eng, ei)
|
|
||||||
PartialFinal = true;
|
|
||||||
|
|
||||||
# Match partial shuangpin if input length is longer than 4
|
|
||||||
PartialSp = false;
|
|
||||||
|
|
||||||
# u <-> v
|
|
||||||
V_U = false;
|
|
||||||
|
|
||||||
# an <-> ang
|
|
||||||
AN_ANG = false;
|
|
||||||
|
|
||||||
# en <-> eng
|
|
||||||
EN_ENG = false;
|
|
||||||
|
|
||||||
# ian <-> iang
|
|
||||||
IAN_IANG = false;
|
|
||||||
|
|
||||||
# in <-> ing
|
|
||||||
IN_ING = false;
|
|
||||||
|
|
||||||
# u <-> ou
|
|
||||||
U_OU = false;
|
|
||||||
|
|
||||||
# uan <-> uang
|
|
||||||
UAN_UANG = false;
|
|
||||||
|
|
||||||
# c <-> ch
|
|
||||||
C_CH = false;
|
|
||||||
|
|
||||||
# f <-> h
|
|
||||||
F_H = false;
|
|
||||||
|
|
||||||
# l <-> n
|
|
||||||
L_N = false;
|
|
||||||
|
|
||||||
# s <-> sh
|
|
||||||
S_SH = false;
|
|
||||||
|
|
||||||
# z <-> zh
|
|
||||||
Z_ZH = false;
|
|
||||||
|
|
||||||
# Correction Layout
|
|
||||||
Correction = "None";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
punctuation.globalSection = {
|
|
||||||
# Toggle key
|
|
||||||
# Hotkey=
|
|
||||||
|
|
||||||
# Half width punctuation after latin letter or number
|
|
||||||
HalfWidthPuncAfterLetterOrNumber = true;
|
|
||||||
|
|
||||||
# Type paired punctuations together (e.g. Quote)
|
|
||||||
TypePairedPunctuationsTogether = false;
|
|
||||||
|
|
||||||
# Enabled
|
|
||||||
Enabled = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
quickphrase.globalSection = {
|
|
||||||
# Trigger Key
|
|
||||||
# TriggerKey=
|
|
||||||
|
|
||||||
# Choose key modifier
|
|
||||||
"Choose Modifier" = "None";
|
|
||||||
|
|
||||||
# Enable Spell check
|
|
||||||
Spell = true;
|
|
||||||
|
|
||||||
# Fallback Spell check language
|
|
||||||
FallbackSpellLanguage = "en";
|
|
||||||
};
|
|
||||||
|
|
||||||
spell.sections = {
|
|
||||||
"ProviderOrder" = {
|
|
||||||
"0" = "Presage";
|
|
||||||
"1" = "Custom";
|
|
||||||
"2" = "Enchant";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
table.globalSection = {
|
|
||||||
# Modify dictionary
|
|
||||||
# ModifyDictionaryKey=
|
|
||||||
|
|
||||||
# Forget word
|
|
||||||
# ForgetWord=
|
|
||||||
|
|
||||||
# Lookup pinyin
|
|
||||||
# LookupPinyinKey=
|
|
||||||
|
|
||||||
# Enable Prediction
|
|
||||||
Prediction = false;
|
|
||||||
|
|
||||||
# Prediction Size
|
|
||||||
PredictionSize = 10;
|
|
||||||
};
|
|
||||||
|
|
||||||
unicode.sections = {
|
|
||||||
"TriggerKey" = {
|
|
||||||
"0" = "Control+Alt+Shift+U";
|
|
||||||
};
|
|
||||||
|
|
||||||
"DirectUnicodeMode" = {
|
|
||||||
"0" = "Control+Shift+U";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
waylandim.globalSection = {
|
|
||||||
# Detect current running application (Need restart)
|
|
||||||
DetectApplication = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
xcb.globalSection = {
|
|
||||||
# Allow Overriding System XKB Settings
|
|
||||||
"Allow Overriding System XKB Settings" = true;
|
|
||||||
|
|
||||||
# Always set layout to be only group layout
|
|
||||||
AlwaysSetToGroupLayout = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
./chromium
|
./chromium
|
||||||
./color
|
./color
|
||||||
./docs
|
./docs
|
||||||
|
./fcitx
|
||||||
./firefox
|
./firefox
|
||||||
./fish
|
./fish
|
||||||
./git
|
./git
|
||||||
|
614
home/modules/fcitx/default.nix
Normal file
614
home/modules/fcitx/default.nix
Normal file
@ -0,0 +1,614 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
mylib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (config.modules) fcitx;
|
||||||
|
in {
|
||||||
|
options.modules.fcitx = import ./options.nix {inherit lib mylib;};
|
||||||
|
|
||||||
|
config = lib.mkIf fcitx.enable {
|
||||||
|
i18n.inputMethod = {
|
||||||
|
enable = true;
|
||||||
|
type = "fcitx5";
|
||||||
|
|
||||||
|
fcitx5 = {
|
||||||
|
waylandFrontend = true;
|
||||||
|
|
||||||
|
addons = with pkgs; [
|
||||||
|
fcitx5-gtk
|
||||||
|
# fcitx5-configtool
|
||||||
|
catppuccin-fcitx5
|
||||||
|
|
||||||
|
libsForQt5.fcitx5-qt # QT5
|
||||||
|
libsForQt5.fcitx5-chinese-addons
|
||||||
|
|
||||||
|
qt6Packages.fcitx5-qt # QT6
|
||||||
|
qt6Packages.fcitx5-chinese-addons
|
||||||
|
];
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
inputMethod = {
|
||||||
|
GroupOrder = {
|
||||||
|
"0" = "Default";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Groups/0" = {
|
||||||
|
# Group Name
|
||||||
|
Name = "Default";
|
||||||
|
|
||||||
|
# Layout
|
||||||
|
"Default Layout" = "us";
|
||||||
|
|
||||||
|
# Default Input Method
|
||||||
|
DefaultIM = "pinyin";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Groups/0/Items/0" = {
|
||||||
|
# Name
|
||||||
|
Name = "keyboard-us";
|
||||||
|
|
||||||
|
# Layout
|
||||||
|
# Layout=
|
||||||
|
};
|
||||||
|
|
||||||
|
"Groups/0/Items/1" = {
|
||||||
|
# Name
|
||||||
|
Name = "pinyin";
|
||||||
|
|
||||||
|
# Layout
|
||||||
|
# Layout=
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
globalOptions = {
|
||||||
|
Hotkey = {
|
||||||
|
# Enumerate when press trigger key repeatedly
|
||||||
|
EnumerateWithTriggerKeys = true;
|
||||||
|
|
||||||
|
# Temporally switch between first and current Input Method
|
||||||
|
# AltTriggerKeys=
|
||||||
|
|
||||||
|
# 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=
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hotkey/TriggerKeys" = {
|
||||||
|
"0" = "Super+space";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hotkey/PrevPage" = {
|
||||||
|
"0" = "Up";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hotkey/NextPage" = {
|
||||||
|
"0" = "Down";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hotkey/PrevCandidate" = {
|
||||||
|
"0" = "Shift+Tab";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hotkey/NextCandidate" = {
|
||||||
|
"0" = "Tab";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hotkey/TogglePreedit" = {
|
||||||
|
"0" = "Control+Alt+P";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Behavior" = {
|
||||||
|
# Active By Default
|
||||||
|
ActiveByDefault = false;
|
||||||
|
|
||||||
|
# Reset state on Focus In
|
||||||
|
resetStateWhenFocusIn = "No";
|
||||||
|
|
||||||
|
# Share Input State
|
||||||
|
ShareInputState = "All";
|
||||||
|
|
||||||
|
# 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 = false;
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
|
||||||
|
# Allow input method in the password field
|
||||||
|
AllowInputMethodForPassword = false;
|
||||||
|
|
||||||
|
# Show preedit text when typing password
|
||||||
|
ShowPreeditForPassword = false;
|
||||||
|
|
||||||
|
# Interval of saving user data in minutes
|
||||||
|
AutoSavePeriod = 30;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
addons = {
|
||||||
|
chttrans.globalSection = {
|
||||||
|
# Translate engine
|
||||||
|
Engine = "OpenCC";
|
||||||
|
|
||||||
|
# Toggle key
|
||||||
|
# Hotkey=
|
||||||
|
|
||||||
|
# Enabled Input Methods
|
||||||
|
# EnabledIM=
|
||||||
|
|
||||||
|
# OpenCC profile for Simplified to Traditional
|
||||||
|
# OpenCCS2TProfile=
|
||||||
|
|
||||||
|
# OpenCC profile for Traditional to Simplified
|
||||||
|
# OpenCCT2SProfile=
|
||||||
|
};
|
||||||
|
|
||||||
|
classicui.globalSection = {
|
||||||
|
# Vertical Candidate List
|
||||||
|
"Vertical Candidate List" = false;
|
||||||
|
|
||||||
|
# Use mouse wheel to go to prev or next page
|
||||||
|
WheelForPaging = true;
|
||||||
|
|
||||||
|
# Font
|
||||||
|
Font = "Sans 12";
|
||||||
|
|
||||||
|
# Menu Font
|
||||||
|
MenuFont = "Sans 12";
|
||||||
|
|
||||||
|
# Tray Font
|
||||||
|
TrayFont = "Sans Bold 10";
|
||||||
|
|
||||||
|
# Tray Label Outline Color
|
||||||
|
TrayOutlineColor = "#000000";
|
||||||
|
|
||||||
|
# Tray Label Text Color
|
||||||
|
TrayTextColor = "#ffffff";
|
||||||
|
|
||||||
|
# Prefer Text Icon
|
||||||
|
PreferTextIcon = false;
|
||||||
|
|
||||||
|
# Show Layout Name In Icon
|
||||||
|
ShowLayoutNameInIcon = true;
|
||||||
|
|
||||||
|
# Use input method language to display text
|
||||||
|
UseInputMethodLanguageToDisplayText = true;
|
||||||
|
|
||||||
|
# Theme
|
||||||
|
Theme = "catppuccin-mocha-lavender";
|
||||||
|
|
||||||
|
# Dark Theme
|
||||||
|
DarkTheme = "catppuccin-mocha-lavender";
|
||||||
|
|
||||||
|
# Follow system light/dark color scheme
|
||||||
|
# NOTE: Doesn't work since I don't set up the environment
|
||||||
|
# so apps can detect if light/dark mode is used
|
||||||
|
UseDarkTheme = true;
|
||||||
|
|
||||||
|
# Follow system accent color if it is supported by theme and desktop
|
||||||
|
UseAccentColor = true;
|
||||||
|
|
||||||
|
# Use Per Screen DPI on X11
|
||||||
|
PerScreenDPI = true;
|
||||||
|
|
||||||
|
# Force font DPI on Wayland
|
||||||
|
ForceWaylandDPI = 0;
|
||||||
|
|
||||||
|
# Enable fractional scale under Wayland
|
||||||
|
EnableFractionalScale = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
clipboard.globalSection = {
|
||||||
|
# Trigger Key
|
||||||
|
# TriggerKey=
|
||||||
|
|
||||||
|
# Paste Primary
|
||||||
|
# PastePrimaryKey=
|
||||||
|
|
||||||
|
# Number of entries
|
||||||
|
"Number of entries" = 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
cloudpinyin.globalSection = {
|
||||||
|
# Minimum Pinyin Length
|
||||||
|
MinimumPinyinLength = 4;
|
||||||
|
|
||||||
|
# Backend
|
||||||
|
Backend = "GoogleCN";
|
||||||
|
|
||||||
|
# Proxy
|
||||||
|
# Proxy=
|
||||||
|
};
|
||||||
|
|
||||||
|
cloudpinyin.sections = {
|
||||||
|
"Toggle Key" = {
|
||||||
|
"0" = "Control+Alt+Shift+C";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fullwidth.globalSection = {
|
||||||
|
# Toggle key
|
||||||
|
# Hotkey=
|
||||||
|
};
|
||||||
|
|
||||||
|
imselector.globalSection = {
|
||||||
|
# Trigger Key
|
||||||
|
# TriggerKey=
|
||||||
|
|
||||||
|
# Trigger Key for only current input context
|
||||||
|
# TriggerKeyLocal=
|
||||||
|
|
||||||
|
# Hotkey for switching to the N-th input method
|
||||||
|
# SwitchKey=
|
||||||
|
|
||||||
|
# Hotkey for switching to the N-th input method for only current input context
|
||||||
|
# SwitchKeyLocal=
|
||||||
|
};
|
||||||
|
|
||||||
|
keyboard.globalSection = {
|
||||||
|
# Page size
|
||||||
|
PageSize = 5;
|
||||||
|
|
||||||
|
# Enable emoji in hint
|
||||||
|
EnableEmoji = false;
|
||||||
|
|
||||||
|
# Enable emoji in quickphrase
|
||||||
|
EnableQuickPhraseEmoji = false;
|
||||||
|
|
||||||
|
# Choose key modifier
|
||||||
|
"Choose Modifier" = "Alt";
|
||||||
|
|
||||||
|
# Enable hint by default
|
||||||
|
EnableHintByDefault = false;
|
||||||
|
|
||||||
|
# Trigger hint mode for one time
|
||||||
|
# "One Time Hint Trigger"=
|
||||||
|
|
||||||
|
# Use new compose behavior
|
||||||
|
UseNewComposeBehavior = true;
|
||||||
|
|
||||||
|
# Type special characters with long press
|
||||||
|
EnableLongPress = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
keyboard.sections = {
|
||||||
|
"PrevCandidate" = {
|
||||||
|
"0" = "Shift+Tab";
|
||||||
|
};
|
||||||
|
|
||||||
|
"NextCandidate" = {
|
||||||
|
"0" = "Tab";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Hint Trigger" = {
|
||||||
|
"0" = "Control+Alt+H";
|
||||||
|
};
|
||||||
|
|
||||||
|
"LongPressBlocklist" = {
|
||||||
|
"0" = "konsole";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
notifications.globalSection = {
|
||||||
|
# Hidden Notifications
|
||||||
|
# HiddenNotifications=
|
||||||
|
};
|
||||||
|
|
||||||
|
pinyin.globalSection = {
|
||||||
|
# Shuangpin Profile
|
||||||
|
ShuangpinProfile = "Ziranma";
|
||||||
|
|
||||||
|
# Show current shuangpin mode
|
||||||
|
ShowShuangpinMode = true;
|
||||||
|
|
||||||
|
# Page size
|
||||||
|
PageSize = 7;
|
||||||
|
|
||||||
|
# Enable Spell
|
||||||
|
SpellEnabled = false;
|
||||||
|
|
||||||
|
# Enable Symbols
|
||||||
|
SymbolsEnabled = true;
|
||||||
|
|
||||||
|
# Enable Chaizi
|
||||||
|
ChaiziEnabled = false;
|
||||||
|
|
||||||
|
# Enable Characters in Unicode CJK Extension B
|
||||||
|
ExtBEnabled = true;
|
||||||
|
|
||||||
|
# Enable Cloud Pinyin
|
||||||
|
CloudPinyinEnabled = true;
|
||||||
|
|
||||||
|
# Cloud Pinyin Index
|
||||||
|
CloudPinyinIndex = 2;
|
||||||
|
|
||||||
|
# Show animation when Cloud Pinyin is loading
|
||||||
|
CloudPinyinAnimation = true;
|
||||||
|
|
||||||
|
# Always show Cloud Pinyin place holder
|
||||||
|
KeepCloudPinyinPlaceHolder = false;
|
||||||
|
|
||||||
|
# Preedit Mode
|
||||||
|
PreeditMode = "Composing pinyin";
|
||||||
|
|
||||||
|
# Fix embedded preedit cursor at the beginning of the preedit
|
||||||
|
PreeditCursorPositionAtBeginning = true;
|
||||||
|
|
||||||
|
# Show complete pinyin in preedit
|
||||||
|
PinyinInPreedit = false;
|
||||||
|
|
||||||
|
# Enable Prediction
|
||||||
|
Prediction = false;
|
||||||
|
|
||||||
|
# Prediction Size
|
||||||
|
PredictionSize = 10;
|
||||||
|
|
||||||
|
# Action when switching input method
|
||||||
|
SwitchInputMethodBehavior = "Commit current preedit";
|
||||||
|
|
||||||
|
# Forget word
|
||||||
|
# ForgetWord=
|
||||||
|
|
||||||
|
# Select 2nd Candidate
|
||||||
|
# SecondCandidate=
|
||||||
|
|
||||||
|
# Select 3rd Candidate
|
||||||
|
# ThirdCandidate=
|
||||||
|
|
||||||
|
# Use Keypad as Selection key
|
||||||
|
UseKeypadAsSelection = false;
|
||||||
|
|
||||||
|
# Use BackSpace to cancel the selection
|
||||||
|
BackSpaceToUnselect = true;
|
||||||
|
|
||||||
|
# Number of Sentences
|
||||||
|
"Number of sentence" = 2;
|
||||||
|
|
||||||
|
# Prompt long word length when input length over (0 for disable)
|
||||||
|
LongWordLengthLimit = 4;
|
||||||
|
|
||||||
|
# Key to trigger quickphrase
|
||||||
|
# QuickPhraseKey=
|
||||||
|
|
||||||
|
# Use V to trigger quickphrase
|
||||||
|
VAsQuickphrase = false;
|
||||||
|
|
||||||
|
# FirstRun
|
||||||
|
FirstRun = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
pinyin.sections = {
|
||||||
|
"PrevPage" = {
|
||||||
|
"0" = "Up";
|
||||||
|
};
|
||||||
|
|
||||||
|
"NextPage" = {
|
||||||
|
"0" = "Down";
|
||||||
|
};
|
||||||
|
|
||||||
|
"PrevCandidate" = {
|
||||||
|
"0" = "Shift+Tab";
|
||||||
|
};
|
||||||
|
|
||||||
|
"NextCandidate" = {
|
||||||
|
"0" = "Tab";
|
||||||
|
};
|
||||||
|
|
||||||
|
"CurrentCandidate" = {
|
||||||
|
"0" = "space";
|
||||||
|
"1" = "KP_Space";
|
||||||
|
};
|
||||||
|
|
||||||
|
"CommitRawInput" = {
|
||||||
|
"0" = "Return";
|
||||||
|
"1" = "KP_Enter";
|
||||||
|
"2" = "Control+Return";
|
||||||
|
"3" = "Control+KP_Enter";
|
||||||
|
"4" = "Shift+Return";
|
||||||
|
"5" = "Shift+KP_Enter";
|
||||||
|
"6" = "Control+Shift+Return";
|
||||||
|
"7" = "Control+Shift+KP_Enter";
|
||||||
|
};
|
||||||
|
|
||||||
|
"ChooseCharFromPhrase" = {
|
||||||
|
"0" = "bracketleft";
|
||||||
|
"1" = "bracketright";
|
||||||
|
};
|
||||||
|
|
||||||
|
"FilterByStroke" = {
|
||||||
|
"0" = "grave";
|
||||||
|
};
|
||||||
|
|
||||||
|
"QuickPhraseTriggerRegex" = {
|
||||||
|
"0" = ".(/|@)$";
|
||||||
|
"1" = "^(www|bbs|forum|mail|bbs)''.";
|
||||||
|
"2" = "^(http|https|ftp|telnet|mailto):";
|
||||||
|
};
|
||||||
|
|
||||||
|
"Fuzzy" = {
|
||||||
|
# ue -> ve
|
||||||
|
VE_UE = true;
|
||||||
|
|
||||||
|
# Common Typo
|
||||||
|
NG_GN = true;
|
||||||
|
|
||||||
|
# Inner Segment (xian -> xi'an)
|
||||||
|
Inner = true;
|
||||||
|
|
||||||
|
# Inner Segment for Short Pinyin (qie -> qi'e)
|
||||||
|
InnerShort = true;
|
||||||
|
|
||||||
|
# Match partial finals (e -> en, eng, ei)
|
||||||
|
PartialFinal = true;
|
||||||
|
|
||||||
|
# Match partial shuangpin if input length is longer than 4
|
||||||
|
PartialSp = false;
|
||||||
|
|
||||||
|
# u <-> v
|
||||||
|
V_U = false;
|
||||||
|
|
||||||
|
# an <-> ang
|
||||||
|
AN_ANG = false;
|
||||||
|
|
||||||
|
# en <-> eng
|
||||||
|
EN_ENG = false;
|
||||||
|
|
||||||
|
# ian <-> iang
|
||||||
|
IAN_IANG = false;
|
||||||
|
|
||||||
|
# in <-> ing
|
||||||
|
IN_ING = false;
|
||||||
|
|
||||||
|
# u <-> ou
|
||||||
|
U_OU = false;
|
||||||
|
|
||||||
|
# uan <-> uang
|
||||||
|
UAN_UANG = false;
|
||||||
|
|
||||||
|
# c <-> ch
|
||||||
|
C_CH = false;
|
||||||
|
|
||||||
|
# f <-> h
|
||||||
|
F_H = false;
|
||||||
|
|
||||||
|
# l <-> n
|
||||||
|
L_N = false;
|
||||||
|
|
||||||
|
# s <-> sh
|
||||||
|
S_SH = false;
|
||||||
|
|
||||||
|
# z <-> zh
|
||||||
|
Z_ZH = false;
|
||||||
|
|
||||||
|
# Correction Layout
|
||||||
|
Correction = "None";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
punctuation.globalSection = {
|
||||||
|
# Toggle key
|
||||||
|
# Hotkey=
|
||||||
|
|
||||||
|
# Half width punctuation after latin letter or number
|
||||||
|
HalfWidthPuncAfterLetterOrNumber = true;
|
||||||
|
|
||||||
|
# Type paired punctuations together (e.g. Quote)
|
||||||
|
TypePairedPunctuationsTogether = false;
|
||||||
|
|
||||||
|
# Enabled
|
||||||
|
Enabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
quickphrase.globalSection = {
|
||||||
|
# Trigger Key
|
||||||
|
# TriggerKey=
|
||||||
|
|
||||||
|
# Choose key modifier
|
||||||
|
"Choose Modifier" = "None";
|
||||||
|
|
||||||
|
# Enable Spell check
|
||||||
|
Spell = true;
|
||||||
|
|
||||||
|
# Fallback Spell check language
|
||||||
|
FallbackSpellLanguage = "en";
|
||||||
|
};
|
||||||
|
|
||||||
|
spell.sections = {
|
||||||
|
"ProviderOrder" = {
|
||||||
|
"0" = "Presage";
|
||||||
|
"1" = "Custom";
|
||||||
|
"2" = "Enchant";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
table.globalSection = {
|
||||||
|
# Modify dictionary
|
||||||
|
# ModifyDictionaryKey=
|
||||||
|
|
||||||
|
# Forget word
|
||||||
|
# ForgetWord=
|
||||||
|
|
||||||
|
# Lookup pinyin
|
||||||
|
# LookupPinyinKey=
|
||||||
|
|
||||||
|
# Enable Prediction
|
||||||
|
Prediction = false;
|
||||||
|
|
||||||
|
# Prediction Size
|
||||||
|
PredictionSize = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
unicode.sections = {
|
||||||
|
"TriggerKey" = {
|
||||||
|
"0" = "Control+Alt+Shift+U";
|
||||||
|
};
|
||||||
|
|
||||||
|
"DirectUnicodeMode" = {
|
||||||
|
"0" = "Control+Shift+U";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
waylandim.globalSection = {
|
||||||
|
# Detect current running application (Need restart)
|
||||||
|
DetectApplication = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
xcb.globalSection = {
|
||||||
|
# Allow Overriding System XKB Settings
|
||||||
|
"Allow Overriding System XKB Settings" = true;
|
||||||
|
|
||||||
|
# Always set layout to be only group layout
|
||||||
|
AlwaysSetToGroupLayout = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
7
home/modules/fcitx/options.nix
Normal file
7
home/modules/fcitx/options.nix
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
mylib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
enable = lib.mkEnableOption "Enable the fcitx5 input method";
|
||||||
|
}
|
Reference in New Issue
Block a user