Write fcitx5 config as key=value so fcitx5 reads the Ctrl+Space trigger
This commit is contained in:
1 parent
5e0ff0df95
commit
a84ad64c9e
2 files changed
+59
-3
No files matched your search
@@ -12,7 +12,7 @@ makedepends=('go')
|
|||||||
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
|
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
|
||||||
'omarchy-offline.patch')
|
'omarchy-offline.patch')
|
||||||
sha256sums=('64008e326ece22d156c0fb634cc784c60a41c48858eb0d949349b41dfd0c5477'
|
sha256sums=('64008e326ece22d156c0fb634cc784c60a41c48858eb0d949349b41dfd0c5477'
|
||||||
'f2b9a8ec97796d4432f3461396fa0332901624e70c873187703b85d61478c384')
|
'95f4fd44200901a4e5499535da5de337cd1d5102d87cac7d57b51b70fb9ffe69')
|
||||||
|
|
||||||
_setup_go_env() {
|
_setup_go_env() {
|
||||||
export GOPATH="$srcdir"
|
export GOPATH="$srcdir"
|
||||||
|
|||||||
@@ -52,10 +52,22 @@ index e3554e8..2efc8c2 100644
|
|||||||
|
|
||||||
type DetectedEnv struct {
|
type DetectedEnv struct {
|
||||||
diff --git a/internal/fcitx/fcitx.go b/internal/fcitx/fcitx.go
|
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
|
--- a/internal/fcitx/fcitx.go
|
||||||
+++ b/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"
|
defaultGroupName = "Default"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -83,6 +95,50 @@ index fba202a..f252ca1 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !env.HasOctagramPlugin {
|
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
|
diff --git a/internal/rime/asset_dir_test.go b/internal/rime/asset_dir_test.go
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..9e66346
|
index 0000000..9e66346
|
||||||
|
|||||||
Reference in new issue
Block a user