From fc757e6613c12ce07d4a578a01e970100bad5c0f Mon Sep 17 00:00:00 2001 From: ulic-youthlic Date: Sun, 6 Jul 2025 01:33:08 +0800 Subject: [PATCH] module(i18n): Config yuhao_star ime to work with rime-ice ime --- home/modules/i18n/default.custom.yaml | 5 +- home/modules/i18n/default.nix | 1 + home/modules/i18n/yustar_sc.custom.yaml | 2 + nixos/modules/i18n.nix | 59 +++++++++++++++++-- pkgs/default.nix | 2 +- .../default.nix} | 2 + pkgs/rime-yuhaostar/key_binder.patch | 48 +++++++++++++++ pkgs/rime-yuhaostar/punctuator.patch | 52 ++++++++++++++++ 8 files changed, 164 insertions(+), 7 deletions(-) create mode 100644 home/modules/i18n/yustar_sc.custom.yaml rename pkgs/{rime-yuhaostar.nix => rime-yuhaostar/default.nix} (89%) create mode 100644 pkgs/rime-yuhaostar/key_binder.patch create mode 100644 pkgs/rime-yuhaostar/punctuator.patch diff --git a/home/modules/i18n/default.custom.yaml b/home/modules/i18n/default.custom.yaml index d09e481..ef8d2af 100644 --- a/home/modules/i18n/default.custom.yaml +++ b/home/modules/i18n/default.custom.yaml @@ -2,6 +2,7 @@ patch: "__include": rime_ice_suggestion:/ "schema_list": - schema: double_pinyin_flypy + - schema: yustar_sc "menu/page_size": 7 "switcher/caption": 「方案选单」 "switcher/hotkeys": @@ -12,7 +13,7 @@ patch: - emoji - full_shape - search_single_char - "switcher/fold_options": false + "switcher/fold_options": true "ascii_composer/good_old_caps_lock": true "ascii_composer/switch_key/Caps_Lock": clear "ascii_composer/switch_key/Shift_L": noop @@ -85,3 +86,5 @@ patch: - { accept: KP_Add, send: plus, when: composing } - { accept: KP_Subtract, send: minus, when: composing } - { accept: KP_Divide, send: slash, when: composing } + + - { accept: Control+space, toggle: ascii_mode, when: always } diff --git a/home/modules/i18n/default.nix b/home/modules/i18n/default.nix index 0e78253..7c5048d 100644 --- a/home/modules/i18n/default.nix +++ b/home/modules/i18n/default.nix @@ -7,6 +7,7 @@ xdg.dataFile = { "fcitx5/rime/default.custom.yaml".source = ./default.custom.yaml; "fcitx5/rime/double_pinyin_flypy.custom.yaml".source = ./double_pinyin_flypy.custom.yaml; + "fcitx5/rime/yustar_sc.custom.yaml".source = ./yustar_sc.custom.yaml; }; }; } diff --git a/home/modules/i18n/yustar_sc.custom.yaml b/home/modules/i18n/yustar_sc.custom.yaml new file mode 100644 index 0000000..27f1041 --- /dev/null +++ b/home/modules/i18n/yustar_sc.custom.yaml @@ -0,0 +1,2 @@ +patch: + "style/horizontal": false diff --git a/nixos/modules/i18n.nix b/nixos/modules/i18n.nix index 5c628b5..0be8387 100644 --- a/nixos/modules/i18n.nix +++ b/nixos/modules/i18n.nix @@ -38,6 +38,7 @@ in { rime-ice rime-zhwiki rime-moegirl + rime-yuhaostar ]; }) ]; @@ -46,7 +47,56 @@ in { # ignoreUserConfig = false; settings = { addons = { - classicui.globalSection.Theme = "FluentDark-solid"; + classicui.globalSection = { + Theme = "FluentDark-solid"; + "Vertical Candidate List" = true; + }; + notifications.globalSection = { + HiddenNotifications = ""; + }; + clipboard.globalSection = { + TriggerKey = ""; + PastePrimaryKey = ""; + }; + }; + globalOptions = { + HotKey = { + ActivateKeys = ""; + AltTriggerKeys = ""; + DeactivateKeys = ""; + EnumerateBackwardKeys = ""; + EnumerateForwardKeys = ""; + EnumerateGroupBackwardKeys = ""; + EnumerateGroupForwardKeys = ""; + EnumerateSkipFirst = false; + EnumerateWithTriggerKeys = true; + ModifierOnlyKeyTimeout = "250"; + NextCandidate = ""; + NextPage = ""; + PrevCandidate = ""; + PrevPage = ""; + TogglePreedit = ""; + TriggerKeys = ""; + }; + Behavior = { + ActiveByDefault = false; + AllowInputMethodForPassword = false; + AutoSavePeriod = 30; + CompactInputMethodInformation = true; + CustomXkbOption = ""; + DefaultPageSize = 7; + DisabledAddons = ""; + EnabledAddons = ""; + OverrideXkbOption = false; + PreeditEnabledByDefault = true; + PreloadInputMethod = true; + ShareInputState = "No"; + ShowFirstInputMethodInformation = true; + ShowInputMethodInformation = true; + ShowPreeditForPassword = false; + resetStateWhenFocusIn = "No"; + showInputMethodInformationWhenFocusIn = false; + }; }; inputMethod = { "Groups/0" = { @@ -55,13 +105,12 @@ in { DefaultIM = "keyboard-us"; }; "Groups/0/Items/0" = { - Name = "keyboard-us"; - Layout = ""; - }; - "Groups/0/Items/1" = { Name = "rime"; Layout = ""; }; + "GroupOrder" = { + "0" = "Default"; + }; }; }; }; diff --git a/pkgs/default.nix b/pkgs/default.nix index 2c4d28c..a914938 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -21,7 +21,7 @@ in { editor-runtime = callPackage ./editor-runtime.nix {}; cliphist = callPackage ./cliphist.nix {}; radicle-ci-broker = callPackage ./radicle-ci-broker.nix {}; - rime-yuhaostar = callPackage ./rime-yuhaostar.nix {}; + rime-yuhaostar = callPackage ./rime-yuhaostar {}; noto-serif-cjk = callPackage ./noto-serif-cjk.nix {}; noto-sans-cjk = callPackage ./noto-sans-cjk.nix {}; diff --git a/pkgs/rime-yuhaostar.nix b/pkgs/rime-yuhaostar/default.nix similarity index 89% rename from pkgs/rime-yuhaostar.nix rename to pkgs/rime-yuhaostar/default.nix index 58d18ec..3da59ba 100644 --- a/pkgs/rime-yuhaostar.nix +++ b/pkgs/rime-yuhaostar/default.nix @@ -13,6 +13,8 @@ in sourceRoot = "schema"; + patches = [./punctuator.patch ./key_binder.patch]; + installPhase = '' runHook preInstall diff --git a/pkgs/rime-yuhaostar/key_binder.patch b/pkgs/rime-yuhaostar/key_binder.patch new file mode 100644 index 0000000..35f7c84 --- /dev/null +++ b/pkgs/rime-yuhaostar/key_binder.patch @@ -0,0 +1,48 @@ +diff --git a/yuhao_pinyin.schema.yaml b/yuhao_pinyin.schema.yaml +index 7b5f1cb..d82945d 100644 +--- a/yuhao_pinyin.schema.yaml ++++ b/yuhao_pinyin.schema.yaml +@@ -75,6 +75,7 @@ punctuator: + "|": "|" + + key_binder: ++ import_preset: default + bindings: + - { when: always, accept: "Control+period", toggle: ascii_punct } + - { when: always, accept: "Control+Shift+period", toggle: ascii_punct } +diff --git a/yustar.schema.yaml b/yustar.schema.yaml +index 96aaded..5f1adaf 100644 +--- a/yustar.schema.yaml ++++ b/yustar.schema.yaml +@@ -307,6 +307,7 @@ punctuator: + "|": "|" + + key_binder: ++ import_preset: default + bindings: + - { when: always, accept: "Control+period", toggle: ascii_punct } + - { when: always, accept: "Control+Shift+period", toggle: ascii_punct } +diff --git a/yustar_sc.schema.yaml b/yustar_sc.schema.yaml +index c2019b6..5a255ea 100644 +--- a/yustar_sc.schema.yaml ++++ b/yustar_sc.schema.yaml +@@ -301,6 +301,7 @@ punctuator: + "|": "|" + + key_binder: ++ import_preset: default + bindings: + - { when: always, accept: "Control+period", toggle: ascii_punct } + - { when: always, accept: "Control+Shift+period", toggle: ascii_punct } +diff --git a/yustar_tw.schema.yaml b/yustar_tw.schema.yaml +index aa9bfdd..e08e66e 100644 +--- a/yustar_tw.schema.yaml ++++ b/yustar_tw.schema.yaml +@@ -298,6 +298,7 @@ punctuator: + "|": "|" + + key_binder: ++ import_preset: default + bindings: + - { when: always, accept: "Control+period", toggle: ascii_punct } + - { when: always, accept: "Control+Shift+period", toggle: ascii_punct } diff --git a/pkgs/rime-yuhaostar/punctuator.patch b/pkgs/rime-yuhaostar/punctuator.patch new file mode 100644 index 0000000..b299c05 --- /dev/null +++ b/pkgs/rime-yuhaostar/punctuator.patch @@ -0,0 +1,52 @@ +diff --git a/yuhao_pinyin.schema.yaml b/yuhao_pinyin.schema.yaml +index 7b5f1cb..f036a64 100644 +--- a/yuhao_pinyin.schema.yaml ++++ b/yuhao_pinyin.schema.yaml +@@ -60,7 +60,7 @@ translator: + - xform/([jqxy])v/$1u/ + + punctuator: +- import_preset: symbols ++ import_preset: default + half_shape: + "`": "`" + "#": "#" +diff --git a/yustar.schema.yaml b/yustar.schema.yaml +index 96aaded..2805afc 100644 +--- a/yustar.schema.yaml ++++ b/yustar.schema.yaml +@@ -292,7 +292,7 @@ yuhao_macro: + expr: return require("yuhao.yuhao_core").unicode() + + punctuator: +- import_preset: symbols ++ import_preset: default + half_shape: + "`": "`" + "#": "#" +diff --git a/yustar_sc.schema.yaml b/yustar_sc.schema.yaml +index c2019b6..3a5a434 100644 +--- a/yustar_sc.schema.yaml ++++ b/yustar_sc.schema.yaml +@@ -286,7 +286,7 @@ yuhao_macro: + expr: return require("yuhao.yuhao_core").unicode() + + punctuator: +- import_preset: symbols ++ import_preset: default + half_shape: + "`": "`" + "#": "#" +diff --git a/yustar_tw.schema.yaml b/yustar_tw.schema.yaml +index aa9bfdd..1530250 100644 +--- a/yustar_tw.schema.yaml ++++ b/yustar_tw.schema.yaml +@@ -283,7 +283,7 @@ yuhao_macro: + expr: return require("yuhao.yuhao_core").unicode() + + punctuator: +- import_preset: symbols ++ import_preset: default + half_shape: + "`": "`" + "#": "#"