From a84ad64c9e04e21d3c51696a29072d86bdd3f49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Tue, 6 Oct 2026 01:49:27 -0400 Subject: [PATCH] Write fcitx5 config as key=value so fcitx5 reads the Ctrl+Space trigger --- pkgbuilds/rime-ice-installer/PKGBUILD | 2 +- .../rime-ice-installer/omarchy-offline.patch | 60 ++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/pkgbuilds/rime-ice-installer/PKGBUILD b/pkgbuilds/rime-ice-installer/PKGBUILD index d24de1c..23f5ba8 100644 --- a/pkgbuilds/rime-ice-installer/PKGBUILD +++ b/pkgbuilds/rime-ice-installer/PKGBUILD @@ -12,7 +12,7 @@ makedepends=('go') source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz" 'omarchy-offline.patch') sha256sums=('64008e326ece22d156c0fb634cc784c60a41c48858eb0d949349b41dfd0c5477' - 'f2b9a8ec97796d4432f3461396fa0332901624e70c873187703b85d61478c384') + '95f4fd44200901a4e5499535da5de337cd1d5102d87cac7d57b51b70fb9ffe69') _setup_go_env() { export GOPATH="$srcdir" diff --git a/pkgbuilds/rime-ice-installer/omarchy-offline.patch b/pkgbuilds/rime-ice-installer/omarchy-offline.patch index eb92e4b..4d6017a 100644 --- a/pkgbuilds/rime-ice-installer/omarchy-offline.patch +++ b/pkgbuilds/rime-ice-installer/omarchy-offline.patch @@ -52,10 +52,22 @@ index e3554e8..2efc8c2 100644 type DetectedEnv struct { diff --git a/internal/fcitx/fcitx.go b/internal/fcitx/fcitx.go -index fba202a..f252ca1 100644 +index fba202a..9710fe3 100644 --- a/internal/fcitx/fcitx.go +++ b/internal/fcitx/fcitx.go -@@ -34,10 +34,23 @@ const ( +@@ -25,6 +25,11 @@ var pacmanPackages = []string{ + "opencc", + } + ++func init() { ++ // fcitx5 reads "key = value" as the key "key ". ++ ini.PrettyFormat = false ++} ++ + const ( + managedBlockStart = "# >>> rime-ice-installer ime begin >>>" + managedBlockEnd = "# <<< rime-ice-installer ime end <<<" +@@ -34,10 +39,23 @@ const ( defaultGroupName = "Default" ) @@ -83,6 +95,50 @@ index fba202a..f252ca1 100644 } if !env.HasOctagramPlugin { +diff --git a/internal/fcitx/ini_format_test.go b/internal/fcitx/ini_format_test.go +new file mode 100644 +index 0000000..3081d96 +--- /dev/null ++++ b/internal/fcitx/ini_format_test.go +@@ -0,0 +1,38 @@ ++package fcitx ++ ++import ( ++ "os" ++ "path/filepath" ++ "strings" ++ "testing" ++) ++ ++func TestConfigFilesUseFcitxKeyValueFormat(t *testing.T) { ++ dir := t.TempDir() ++ config := filepath.Join(dir, "config") ++ profile := filepath.Join(dir, "profile") ++ if err := ensureGlobalConfig(config); err != nil { ++ t.Fatal(err) ++ } ++ if err := ensureProfile(profile); err != nil { ++ t.Fatal(err) ++ } ++ ++ for path, lines := range map[string][]string{ ++ config: {"0=Control+space", "ModifierOnlyKeyTimeout=-1"}, ++ profile: {"Name=" + defaultGroupName, "Default Layout=us", "DefaultIM=rime", "Name=" + keyboardUS, "Name=rime"}, ++ } { ++ content, err := os.ReadFile(path) ++ if err != nil { ++ t.Fatal(err) ++ } ++ if strings.Contains(string(content), " = ") { ++ t.Fatalf("%s pads \"=\" with spaces, which fcitx5 keeps in the key name:\n%s", filepath.Base(path), content) ++ } ++ for _, line := range lines { ++ if !strings.Contains("\n"+string(content)+"\n", "\n"+line+"\n") { ++ t.Fatalf("%s is missing the line %q:\n%s", filepath.Base(path), line, content) ++ } ++ } ++ } ++} diff --git a/internal/rime/asset_dir_test.go b/internal/rime/asset_dir_test.go new file mode 100644 index 0000000..9e66346