parent
8815c9e186
commit
10ffa340b7
@ -0,0 +1,147 @@ |
||||
[Hotkey] |
||||
# Trigger Input Method |
||||
#TriggerKey=CTRL_SPACE |
||||
# Use extra trigger key only after using it to inactivate |
||||
# Available Value: |
||||
# True False |
||||
#UseExtraTriggerKeyOnlyWhenUseItToInactivate=True |
||||
# Extra key for trigger input method |
||||
# Available Value: |
||||
# R_CTRL |
||||
# R_SHIFT |
||||
# L_SHIFT |
||||
# L_CTRL |
||||
# ALT_L_SHIFT |
||||
# ALT_R_SHIFT |
||||
# CTRL Both |
||||
# SHIFT Both |
||||
# L_ALT |
||||
# R_ALT |
||||
# ALT Both |
||||
# Left Super |
||||
# Right Super |
||||
# Super Both |
||||
# Ctrl+Left Super |
||||
# Ctrl+Right Super |
||||
# Super+Left Ctrl |
||||
# Super+Right Ctrl |
||||
# Disabled |
||||
# Custom |
||||
SwitchKey=Disabled |
||||
# Custom switch key |
||||
#CustomSwitchKey= |
||||
# Activate input method |
||||
#ActivateKey= |
||||
# Inactivate Input Method |
||||
#InactivateKey= |
||||
# Enable Hotkey to scroll Between Input Method |
||||
# Available Value: |
||||
# True False |
||||
#IMSwitchKey=True |
||||
# Include Inactivate when scrolling between Input Method |
||||
# Available Value: |
||||
# True False |
||||
#IMSwitchIncludeInactive=False |
||||
# Scroll between Input Method |
||||
# Available Value: |
||||
# CTRL_SHIFT |
||||
# ALT_SHIFT |
||||
# CTRL_SUPER |
||||
# ALT_SUPER |
||||
IMSwitchHotkey=ALT_SHIFT |
||||
# Reload configuration |
||||
#ReloadConfig=CTRL_5 |
||||
# Interval of Two Key Input |
||||
TimeInterval=240 |
||||
# Switching Virtual Keyboard |
||||
#VKSwitchKey=CTRL_ALT_B |
||||
# Switching Remind Mode |
||||
#RemindSwitchKey= |
||||
# Switching Full Width Character Mode |
||||
#FullWidthSwitchKey= |
||||
# Switch Full Width Punc Mode |
||||
#PuncSwitchKey=CTRL_. |
||||
# Prev Page |
||||
#PrevPageKey=- UP |
||||
# Next Page |
||||
#NextPageKey== DOWN |
||||
# Choose Second and Third Candidate Word |
||||
#SecondThirdCandWordKey= |
||||
# Saving All Config and Input History |
||||
#SaveAllKey=CTRL_ALT_S |
||||
# Switch Embeded Preedit |
||||
#SwitchPreedit=CTRL_ALT_P |
||||
# Previous Candidate Word |
||||
#PrevWord=SHIFT_TAB |
||||
# Next Candidate Word |
||||
#NextWord=TAB |
||||
|
||||
[Program] |
||||
# Seconds sleep before fcitx really start |
||||
DelayStart=5 |
||||
# Share State Among Window |
||||
# Available Value: |
||||
# No |
||||
# All |
||||
# PerProgram |
||||
#ShareStateAmongWindow=No |
||||
# Default Input Method State |
||||
# Available Value: |
||||
# Inactive |
||||
# Active |
||||
#DefaultInputMethodState=Inactive |
||||
|
||||
[Output] |
||||
# Type half width Punc After a Number |
||||
# Available Value: |
||||
# True False |
||||
#HalfPuncAfterNumber=True |
||||
# Disable Paging in Remind Mode |
||||
# Available Value: |
||||
# True False |
||||
#RemindModeDisablePaging=True |
||||
# Commit when toggle state |
||||
# Available Value: |
||||
# True False |
||||
#SendTextWhenSwitchEng=True |
||||
# Candidate Word Number |
||||
#CandidateWordNumber=5 |
||||
# Give the tips of Phrase |
||||
# Available Value: |
||||
# True False |
||||
#PhraseTips=True |
||||
# Do not commit preedit text when unfocus a window |
||||
# Available Value: |
||||
# True False |
||||
#DontCommitPreeditWhenUnfocus=False |
||||
|
||||
[Appearance] |
||||
# Show Input Method Hint After Input method changed |
||||
# Available Value: |
||||
# True False |
||||
#ShowInputWindowAfterTriggering=True |
||||
# Show Input Method Hint After Input method changed and Focus in |
||||
# Available Value: |
||||
# True False |
||||
#ShowInputWindowWhenFocusIn=False |
||||
# Input Method Hint will be only shown when state is active |
||||
# Available Value: |
||||
# True False |
||||
#ShowInputWindowOnlyWhenActive=True |
||||
# Show Input Speed |
||||
# Available Value: |
||||
# True False |
||||
#ShowInputSpeed=False |
||||
# Show Version |
||||
# Available Value: |
||||
# True False |
||||
#ShowVersion=False |
||||
# Do not show input window if there is only preedit string |
||||
# Available Value: |
||||
# True False |
||||
#HideInputWindowWhenOnlyPreeditString=False |
||||
# Do not show input window if there is only one candidate and preedit |
||||
# Available Value: |
||||
# True False |
||||
#HideInputWindowWhenOnlyOneCandidate=False |
||||
|
@ -0,0 +1,154 @@ |
||||
import ../make-test-python.nix ( |
||||
{ |
||||
pkgs, ... |
||||
}: |
||||
# copy_from_host works only for store paths |
||||
let |
||||
fcitx_profile_file_host = pkgs.writeTextFile { |
||||
name = "fcitx_profile"; |
||||
text = builtins.readFile ./profile; |
||||
}; |
||||
|
||||
fcitx_config_file_host = pkgs.writeTextFile { |
||||
name = "fcitx_config"; |
||||
text = builtins.readFile ./config; |
||||
}; |
||||
in |
||||
|
||||
rec { |
||||
name = "fcitx"; |
||||
machine = |
||||
{ |
||||
pkgs, |
||||
... |
||||
}: |
||||
{ |
||||
virtualisation.memorySize = 1024; |
||||
|
||||
imports = [ |
||||
../common/user-account.nix |
||||
]; |
||||
|
||||
environment.systemPackages = [ |
||||
# To avoid clashing with xfce4-terminal |
||||
pkgs.alacritty |
||||
]; |
||||
|
||||
|
||||
services.xserver = |
||||
{ |
||||
enable = true; |
||||
|
||||
displayManager = { |
||||
lightdm.enable = true; |
||||
autoLogin = { |
||||
enable = true; |
||||
user = "alice"; |
||||
}; |
||||
}; |
||||
|
||||
desktopManager.xfce.enable = true; |
||||
}; |
||||
|
||||
i18n = { |
||||
inputMethod = { |
||||
enabled = "fcitx"; |
||||
fcitx.engines = [ |
||||
pkgs.fcitx-engines.m17n |
||||
pkgs.fcitx-engines.table-extra |
||||
]; |
||||
}; |
||||
}; |
||||
} |
||||
; |
||||
|
||||
testScript = { nodes, ... }: |
||||
let |
||||
user = nodes.machine.config.users.users.alice; |
||||
userName = user.name; |
||||
userHome = user.home; |
||||
xauth = "${userHome}/.Xauthority"; |
||||
fcitx_confdir = "${userHome}/.config/fcitx"; |
||||
in |
||||
'' |
||||
# We need config files before login session |
||||
# So copy first thing |
||||
|
||||
# Point and click would be expensive, |
||||
# So configure using files |
||||
machine.copy_from_host( |
||||
"${fcitx_profile_file_host}", |
||||
"${fcitx_confdir}/profile", |
||||
) |
||||
machine.copy_from_host( |
||||
"${fcitx_config_file_host}", |
||||
"${fcitx_confdir}/config", |
||||
) |
||||
|
||||
start_all() |
||||
|
||||
machine.wait_for_file("${xauth}") |
||||
machine.succeed("xauth merge ${xauth}") |
||||
|
||||
machine.sleep(5) |
||||
|
||||
machine.succeed("su - ${userName} -c 'alacritty&'") |
||||
machine.succeed("su - ${userName} -c 'fcitx&'") |
||||
machine.sleep(10) |
||||
|
||||
### Type on terminal |
||||
machine.send_chars("echo ") |
||||
machine.sleep(1) |
||||
|
||||
### Start fcitx Unicode input |
||||
machine.send_key("ctrl-alt-shift-u") |
||||
machine.sleep(5) |
||||
machine.sleep(1) |
||||
|
||||
### Search for smiling face |
||||
machine.send_chars("smil") |
||||
machine.sleep(1) |
||||
|
||||
### Navigate to the second one |
||||
machine.send_key("tab") |
||||
machine.sleep(1) |
||||
|
||||
### Choose it |
||||
machine.send_key("\n") |
||||
machine.sleep(1) |
||||
|
||||
### Start fcitx language input |
||||
machine.send_key("ctrl-spc") |
||||
machine.sleep(1) |
||||
|
||||
### Default zhengma, enter 一下 |
||||
machine.send_chars("a2") |
||||
machine.sleep(1) |
||||
|
||||
### Switch to Harvard Kyoto |
||||
machine.send_key("alt-shift") |
||||
machine.sleep(1) |
||||
|
||||
### Enter क |
||||
machine.send_chars("ka ") |
||||
machine.sleep(1) |
||||
|
||||
machine.send_key("alt-shift") |
||||
machine.sleep(1) |
||||
|
||||
### Turn off Fcitx |
||||
machine.send_key("ctrl-spc") |
||||
machine.sleep(1) |
||||
|
||||
### Redirect typed characters to a file |
||||
machine.send_chars(" > fcitx_test.out\n") |
||||
machine.sleep(1) |
||||
machine.screenshot("terminal_chars") |
||||
|
||||
### Verify that file contents are as expected |
||||
file_content = machine.succeed("cat ${userHome}/fcitx_test.out") |
||||
assert file_content == "☺一下क\n" |
||||
'' |
||||
; |
||||
} |
||||
) |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue