├── .gitignore ├── LICENSE ├── README.md ├── WINDOWS_README.md ├── backup └── deploy.old.rb ├── custom ├── default.custom.yaml ├── rime_ice.custom.yaml ├── squirrel.custom.yaml └── weasel.custom.yaml ├── deploy.rb ├── images ├── result.png ├── rime.jpeg ├── windows │ ├── 01-install-ruby │ │ ├── step1-install-ruby.png │ │ ├── step2-accept.png │ │ ├── step3-default-path.png │ │ ├── step4-select-all.png │ │ ├── step5-finished.png │ │ ├── step6-dev-chain.png │ │ └── step7-install-ruby-success.png │ ├── 04-install-rime │ │ └── step1-default-path.png │ └── 05-run-script │ │ ├── step1-quit-servce.png │ │ ├── step2-open-terminal.png │ │ └── step3-success-run.png └── working.png ├── installer.rb ├── lib ├── config.rb └── core.rb ├── os ├── LinuxDistro.rb ├── MacOS.rb └── Windows.rb └── share └── upgrade.rb /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Mark24 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rime auto deploy 2 | 3 | -- Rime输入法安装脚本,让一切更轻松 4 | 5 | 一个自用的脚本,帮助无痛快速安装、部署 Rime 输入法(中州韵、小狼毫,鼠须管)以及部署配置 6 | 7 | * 集成 雾凇拼音配置,来源 https://dvel.me/posts/rime-ice/ 8 | * 支持 模糊拼音以及配置 9 | * 集成 20款 输入法皮肤, 来源 https://simgv.com/2022/01/11/rime-skin/ 包括微信皮肤 10 | * 新增主题。支持Linux、MacOS 11 | 12 | --- 13 | QQ 交流群: 14 | 15 | * 761103715 16 | 17 | --- 18 | 19 | # 一、不同系统下使用说明 20 | 21 | ## 系统 22 | 23 | ⚠️ 支持: 24 | 25 | * MacOS ✅ 26 | * Linux 发行版 ✅ 27 | * Windows ✅ [查看 Windows 下的说明文档](./WINDOWS_README.md) 28 | 29 | ![rime](./images/rime.jpeg) 30 | ![result](./images/result.png) 31 | ![working](./images/working.png) 32 | 33 | ## 依赖 34 | 35 | 安装 `Ruby 3` 36 | 37 | * Mac OS `brew install ruby` 38 | * Debian Linux distro `sudo apt install ruby` 39 | * 其他 Linux 根据自己情况判断。有些 Linux 可能自带 Ruby 40 | 41 | ⚠️ MacOS脚本会自动帮助安装 Rime,Linux下由于发行版、Rime 衍生方式太多,需要自行提前安装 Rime 42 | 43 | ``` 44 | For Fcitx5, install fcitx5-rime. 45 | For Fcitx, install fcitx-rime. 46 | For IBus, install ibus-rime. 47 | 48 | more: https://wiki.archlinux.org/title/Rime 49 | ``` 50 | 51 | ## MacOS/Linux 使用方法 52 | 53 | 54 | > Linux发行版和包管理太多,需要执行安装 Rime。MacOS 使用 brew 自动安装,需要拥有 brew 55 | 56 | 57 | - step1: 克隆/下载 latest 最新的稳定版到本地 58 | - `git clone --depth=1 https://github.com/Mark24Code/rime-auto-deploy.git --branch latest` 59 | - step2: 进入项目目录 60 | - `cd rime-auto-deploy` 61 | - step3: 执行部署脚本 62 | - `./installer.rb` 63 | 64 | ## Windows 使用方法 65 | 66 | [查看 Windows 下的说明文档](./WINDOWS_README.md) 67 | 68 | # 二、工作模式说明 69 | 70 | ## 1. 自动模式 (Auto Mode) 71 | 72 | 适用于第一次安装输入法 73 | 74 | ``` 75 | - step01: 确认安装 Rime 输入法,自动安装 76 | - 需要用户自行登出,重进系统,设置Rime输入法为系统输入法 77 | - step02: 备份 Rime 默认配置 78 | - step03: 自动安装 Rime-ice 配置 79 | - step04: 自动追加自定义配置模板 80 | ``` 81 | 82 | ## 2. 手动模式 (Manual Mode) 83 | 84 | 手动模式可以自定义选择自动部署中 step 01~04 分别单独执行 85 | 适用于想要单独对步骤进行运行,比如获取最新的 雾凇拼音配置、调试更新修改自定义配置 86 | 87 | ⚠️ 提示 88 | 89 | ### 1. 如果您已经安装了Rime,想手动执行:使用最新版本的 雾凇拼音 90 | 91 | 为了避免直接执行 `03` 会造成目录冲突,这里建议先执行 `02` 进行配置备份,再手动执行 `03` 进行配置下载 92 | 93 | > 备份文件并不会消失。而是会换个名字。放在同一个目录下。方便找回数据。如果觉得太冗余,可以手动删除历史备份的 `Rime.xxx.old` 的目录 94 | 95 | ### 2. 如果想进行自定义配置 96 | 97 | - 配置文件放在 `custom/` 目录中。在 `04` 步执行之后,会复制进入 Rime 的配置目录 98 | 99 | - 你可以把自己的配置放在 `custom/` 目录下一起被复制 100 | 101 | - 你可以修改 `custom/` 目录下的配置。 参见 `三、自定义配置` 部分 102 | 103 | - ⚠️ RIME 配置使用了 YAML 格式,对空格、缩进保持敏感,尽可能地对齐。 `#` 前缀表示这行配置不生效,去除则生效 104 | 105 | - 配置文件可以对模糊拼音、皮肤、字体进行进一步的设置 106 | 107 | - 编辑完成保存文件,再手动执行 `04` 单独更新配置 108 | 109 | ## 3. 升级模式(Upgrade Mode) 110 | 111 | ``` 112 | === Rime Deploy ==== 113 | welcome to use Rime installer. 114 | 115 | Choose mode: 116 | [1] Auto mode: Suitable for first-time operation. 117 | [2] Handle mode: Decide to execute on your own. 118 | [3] Upgrade mode: Suitable for upgrade exist Rime <---- 更新模式 v3.2.0 新增 119 | Tips: input the index. e.g: 1; Ctrl-C exit. 120 | ``` 121 | 122 | 升级模式用来解决,适用于第一次安装脚本之后,后续想单独的更新上游配置 123 | 124 | ``` 125 | [Upgrade Mode] 126 | 127 | Choose mode: 128 | [1] Upgrade rime auto deploy <---- 更新这个脚本自己,仅限于 git 下载方式 129 | [2] Upgrade rime config <---- 更新配置仓库,目前是 雾凇拼音,会升级到最新 130 | Tips: input the index. e.g: 1; Ctrl-C exit. 131 | ``` 132 | 133 | 134 | # 三、自定义配置 135 | 136 | ## 1. 自定义模糊拼音 137 | 138 | 编辑 `custom/rime_ice.custom.yaml` 中模糊拼音定义部分 139 | 140 | 然后保存文件,重新执行脚本,进入手动模式,单独执行 step04,重新部署 Rime 141 | 142 | ## 2. 修改皮肤 143 | 144 | * MacOS 修改 `squirrel.custom.yaml` 145 | * Windows 修改 `weasel.custom.yaml` 146 | 147 | 148 | ``` 149 | style: 150 | color_scheme: <白天模式主题> 151 | color_scheme_dark: <黑夜模式主题> 152 | 153 | # 皮肤列表 154 | preset_color_schemes: 155 | macos_light: # <--- 上面的主题,可以替换为下面的主题名字 156 | ..... 157 | ``` 158 | 159 | 然后保存文件,重新执行脚本,进入手动模式,单独执行 step04,重新部署 Rime 160 | 161 | ## 2.1 修改皮肤字体大小 162 | 163 | 找到上面正在使用的皮肤名称 164 | 165 | ``` 166 | font_point: 16 # <---- 修改对应皮肤的 字体大小, 推荐范围 16~22 167 | ``` 168 | 169 | 然后保存文件,重新执行脚本,进入手动模式,单独执行 step04,重新部署 Rime 170 | 171 | 172 | # 四、参考 & 鸣谢 173 | 174 | 175 | * 流程参考: Tiwtter @lewangdev 176 | * 配置来源: https://github.com/iDvel/rime-ice 177 | 178 | 179 | # 最后 180 | 181 | 到这里看来已经解决了您的问题。可以愉快的使用 Rime!让我们 🍻 182 | 183 | 后续,如果您遇到了使用问题,可以: 184 | 185 | * [如果遇到了问题、建议 可以点击这段文字创建一个 Github Issue 给我,我会尽可能的答复](https://github.com/Mark24Code/rime-auto-deploy/issues/new) 186 | * 发邮件给我 mark.zhangyoung@qq.com 187 | 188 | ---- 189 | 190 | 如果您觉得帮到您了,节省了大量时间。可以请作者喝杯可乐~ 🥳 191 | 192 | 微信 193 | 194 | ![weixin](http://ww1.sinaimg.cn/small/44894cbbgw1f70k6ctxg4j208908a3zq.jpg) 195 | 196 | 支付宝 197 | 198 | ![zhifubao](http://ww3.sinaimg.cn/small/44894cbbgw1f70k0qnm93j20dd0ddtak.jpg) 199 | 200 | 201 | 202 | [![Star History Chart](https://api.star-history.com/svg?repos=Mark24Code/rime-auto-deploy&type=Date)](https://star-history.com/#Mark24Code/rime-auto-deploy&Date) 203 | -------------------------------------------------------------------------------- /WINDOWS_README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Windows下的说明 4 | 5 | 不同于 MacOS、Linux 大部分的工具已经内置,亦或者系统有包管理器(方便下载软件的一种软件)可以方便安装软件。Windows 用户需要自己安装必要的软件环境。 6 | 7 | ## 01 环境准备:安装 Ruby 8 | 9 | Ruby 类似于 Python 是一个脚本语言。需要借助解释器工作,如果把这两个语言官方解释器都比喻做发动机,Ruby3 的更加精巧、性能更高。 为了能运行脚本,需要在系统中提前安装 Ruby 解释器。 10 | 11 | ### Windows 上通过 RubyInstaller 安装 Ruby 12 | 13 | 全部版本下载地址: https://rubyinstaller.org/downloads/ 14 | 15 | 16 | 也可以点击下面直接下载 Ruby 3.2.2(14.3M),选择适合你的架构版本。 17 | 18 | * [ Ruby 3.2.2-1 (x64) ](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.2-1/rubyinstaller-3.2.2-1-x64.exe) 19 | * [Ruby 3.2.2-1 (x86) ](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.2-1/rubyinstaller-3.2.2-1-x86.exe) 20 | 21 | 22 | > 官网提供 Ruby + DevKit 的 RubyInstaller 适合开发者。我们暂时不需要,感兴趣的可以自行探索。 23 | 24 | #### Ruby 安装设置建议 25 | 26 | 1. 按照默认工作的方式进行勾选 27 | 28 | ⚠️ 关注添加到 PATH 的选项,如果出现请务必勾选 29 | 30 | 文件夹 `/images/windows/01-install-ruby` 给出 Ruby + DevKit 版本的完整图示。 31 | 32 | 安装其实一路默认点`继续`就好了 33 | 34 | 第一次打开终端,可能会有询问窗口,是否要安装开发者工具。普通用户选择 `1` 就好了。 Ruby开发者 `3` 更加合适。 35 | 36 | ![dev-chain](/images/windows/01-install-ruby/step6-dev-chain.png) 37 | 38 | 39 | 2. Windows 终端设置代理 40 | 41 | 42 | 终端执行下载任务,比如下载 `MSYS2 development toolchain` ,或者通过 git 下载代码,可能会遇到 GFW 制造的网络问题。 43 | 44 | 如果遇到网络问题,需要自备梯子,并且给终端设置代理之后,再执行命令。 45 | 46 | 设置代理命令,例子如下: “7890” 替换成你本地梯子的端口 47 | 48 | ⚠️有的梯子需设置里要打开“局域网内允许代理”类似的设置。 49 | ``` 50 | set http_proxy=127.0.0.1:7890 51 | set https_proxy=127.0.0.1:7890 52 | ``` 53 | 54 | 参考: [windows终端命令行下如何使用代理? ](https://github.com/shadowsocks/shadowsocks-windows/issues/1489) 55 | 56 | 57 | 58 | ## 02 环境安装: 安装 Git 59 | 60 | 下载配置仓库需要 Git。 Windows 可以去 Git 的官网安装 Git。 61 | 62 | [https://git-scm.com/downloads](https://git-scm.com/downloads) 63 | 64 | 按照默认的设置,一路确认安装即可。 65 | 66 | ⚠️ 关注添加到 PATH 的选项,如果出现请务必勾选 67 | 68 | 69 | 70 | ## 03 下载脚本 71 | 72 | 有两种方式 73 | 74 | 1. 可以通过 git 下载 75 | 76 | 终端里,先进入想要存放的目录,执行: 77 | 78 | `git clone https://github.com/Mark24Code/rime-auto-deploy.git` 79 | 80 | 2. 或者到下面的路径下载最新版本源码压缩包,解压到目录 81 | 82 | https://github.com/Mark24Code/rime-auto-deploy/releases 83 | 84 | 85 | 86 | ## 04 环境安装: 安装 Rime 中州韵 87 | 88 | 在这里自行下载安装 Windows 版本的 Rime 中州韵 89 | 90 | [https://rime.im/download/](https://rime.im/download/) 91 | 92 | 自行安装, 务必 ⚠️采用默认路径安装。 93 | 94 | ![default-path](/images/windows/04-install-rime/step1-default-path.png) 95 | 96 | 97 | ## 05 执行脚本 98 | 99 | ⚠️可能会遇到: 正在运行的程序会无法替换配置文件夹 100 | 101 | 执行脚本,最好排除干扰,终止Rime运行: 102 | 103 | * 执行中止 Rime小狼毫 的服务。 104 | * 或者直接在项目管理器中退出Rime小狼毫进程(推荐)。 105 | 106 | ![stop-service](/images/windows/05-run-script/step1-quit-servce.png) 107 | 108 | 109 | 打开下载脚本目录,右击使用终端打开所在目录。 110 | 111 | ![run-script](/images/windows/05-run-script/step2-open-terminal.png) 112 | 113 | 114 | 执行 `ruby .\installer.rb` 115 | 116 | ![success](/images/windows/05-run-script/step3-success-run.png) 117 | -------------------------------------------------------------------------------- /backup/deploy.old.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts "==== Rime auto deploy ====" 4 | puts "Have you installed Rime?(y/n)" 5 | 6 | result = gets 7 | if result.strip != "y" 8 | puts "(1/4) Install rime ? (y/n)" 9 | result = gets 10 | system("brew install --cask squirrel") if result.strip == "y" 11 | puts "step1: Logout and relogin system" 12 | puts "step2: Make Rime Input as your input method in system pane." 13 | puts "step3: Rerun this program, jump over install Rime step." 14 | else 15 | puts "Do you want to continue?(y/n)" 16 | result = gets 17 | exit 0 if result.strip != "y" 18 | 19 | puts "(2/4) Backup Rime default config." 20 | puts "run `mv ~/Library/Rime ~/Library/Rime.old`" 21 | system("mv ~/Library/Rime ~/Library/Rime.old") 22 | puts "done ✅" 23 | puts "" 24 | puts "(3/4) Install Rime-ice config." 25 | puts "run `git clone --depth=1 https://github.com/Mark24Code/rime-ice.git ~/Library/Rime`" 26 | system( 27 | "git clone --depth=1 https://github.com/Mark24Code/rime-ice.git ~/Library/Rime" 28 | ) 29 | puts "done ✅" 30 | puts "" 31 | puts "(4/4) Download Custom config." 32 | system("cp ./default.custom.yaml ~/Library/Rime/") 33 | system("cp ./squirrel.custom.yaml ~/Library/Rime/") 34 | puts "done ✅" 35 | puts "" 36 | puts "Deploy finised" 37 | puts "Please open Rime setting pane and click `Deploy`. Enjoy~ 🍻" 38 | end 39 | -------------------------------------------------------------------------------- /custom/default.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | # 菜单 3 | menu: 4 | page_size: 8 # 候选词个数 5 | # alternative_select_labels: [ ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨, ⑩ ] # 修改候选项标签 6 | # alternative_select_keys: ASDFGHJKL # 如编码字符占用数字键,则需另设选字键 7 | # ascii_mode、inline、no_inline、vim_mode 等等设定,可参考 /Library/Input Methods/Squirrel.app/Contents/SharedSupport/squirrel.yaml 8 | # 中西文切换 9 | # 10 | # 【good_old_caps_lock】 CapsLock 切换到大写或切换中英。 11 | # (macOS 偏好设置的优先级更高,如果勾选【使用大写锁定键切换“ABC”输入法】则始终会切换输入法) 12 | # 13 | # 切换中英: 14 | # 不同的选项表示:打字打到一半时按下了 CapsLock、Shift、Control 后: 15 | # commit_code 上屏原始的编码,然后切换到英文 16 | # commit_text 上屏拼出的词句,然后切换到英文 17 | # clear 清除未上屏内容,然后切换到英文 18 | # inline_ascii 无输入时,切换中英;有输入时,切换到临时英文模式,按回车上屏后回到中文状态 19 | # noop 屏蔽快捷键,不切换中英,但不要屏蔽 CapsLock 20 | ascii_composer: 21 | good_old_caps_lock: true # true | false 22 | switch_key: 23 | Caps_Lock: clear # commit_code | commit_text | clear 24 | Shift_L: clear # commit_code | commit_text | inline_ascii | clear | noop 25 | Shift_R: clear # commit_code | commit_text | inline_ascii | clear | noop 26 | Control_L: noop # commit_code | commit_text | inline_ascii | clear | noop 27 | Control_R: noop # commit_code | commit_text | inline_ascii | clear | noop -------------------------------------------------------------------------------- /custom/rime_ice.custom.yaml: -------------------------------------------------------------------------------- 1 | # 添加了模糊音的自定义配置文件 rime_ice.custom.yaml 2 | # https://github.com/Mark24Code/rime-auto-deploy/issues/1 3 | patch: 4 | # 拼写设定 5 | speller: 6 | # 如果不想让什么标点直接上屏,可以加在 alphabet,或者编辑标点符号为两个及以上的映射 7 | alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA 8 | delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。 9 | algebra: 10 | ### 模糊音 11 | # 声母 12 | - derive/^([zcs])h/$1/ # z c s → zh ch sh 13 | - derive/^([zcs])([^h])/$1h$2/ # zh ch sh → z c s 14 | - derive/^l/n/ # n → l 15 | - derive/^n/l/ # l → n 16 | - derive/^f/h/ # ………… 17 | - derive/^h/f/ # ………… 18 | # - derive/^l/r/ 19 | # - derive/^r/l/ 20 | # - derive/^g/k/ 21 | # - derive/^k/g/ 22 | # 韵母 23 | # - derive/ang/an/ 24 | # - derive/an/ang/ 25 | # - derive/eng/en/ 26 | # - derive/en/eng/ 27 | # - derive/in/ing/ 28 | # - derive/ing/in/ 29 | # - derive/ian/iang/ 30 | # - derive/iang/ian/ 31 | # - derive/uan/uang/ 32 | # - derive/uang/uan/ 33 | # - derive/ai/an/ 34 | # - derive/an/ai/ 35 | # - derive/ong/un/ 36 | # - derive/un/ong/ 37 | # - derive/ong/on/ 38 | # - derive/iong/un/ 39 | # - derive/un/iong/ 40 | # - derive/ong/eng/ 41 | # - derive/eng/ong/ 42 | # 拼音音节 43 | # - derive/^fei$/hui/ 44 | # - derive/^hui$/fei/ 45 | # - derive/^hu$/fu/ 46 | # - derive/^fu$/hu/ 47 | # - derive/^wang$/huang/ 48 | # - derive/^huang$/wang/ 49 | 50 | ### 旧时的拼写规则 51 | # - derive/un$/uen/ 52 | # - derive/ui$/uei/ 53 | # - derive/iu$/iou/ 54 | 55 | ### 超级简拼 56 | - erase/^hm$/ # 响应超级简拼,取消「噷 hm」的独占 57 | - erase/^m$/ # 响应超级简拼,取消「呣 m」的独占 58 | - erase/^n$/ # 响应超级简拼,取消「嗯 n」的独占 59 | - erase/^ng$/ # 响应超级简拼,取消「嗯 ng」的独占 60 | - abbrev/^([a-z]).+$/$1/ # 超级简拼 61 | - abbrev/^([zcs]h).+$/$1/ # 超级简拼中,zh ch sh 视为整体(ch'sh → 城市),而不是像这样分开(c'h's'h → 吃好睡好)。 62 | 63 | ### v u 转换,增加对词库中「nue/nve」「qu/qv」等不同注音的支持 64 | - derive/^([nl])ue$/$1ve/ 65 | - derive/^([nl])ve$/$1ue/ 66 | - derive/^([jqxy])u/$1v/ 67 | - derive/^([jqxy])v/$1u/ 68 | 69 | ### 可输入大写字母,做了 xlit 转写是为了适配双拼 70 | - xlit/āḃçďēḟḡĥīĵḱĺḿńōṕɋŕśťūṽẃẋȳź/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ 71 | 72 | ### 自动纠错 73 | # 有些规则对全拼简拼混输有副作用:如「x'ai 喜爱」被纠错为「xia 下」 74 | # zh、ch、sh 75 | - derive/([zcs])h(a|e|i|u|ai|ei|an|en|ou|uo|ua|un|ui|uan|uai|uang|ang|eng|ong)$/h$1$2/ # hzi → zhi 76 | - derive/([zcs])h([aeiu])$/$1$2h/ # zih → zhi 77 | # ai 78 | - derive/^([wghk])ai$/$1ia/ # wia → wai 79 | # ia 80 | - derive/([qjx])ia$/$1ai/ # qai → qia 81 | # ei 82 | - derive/([wtfghkz])ei$/$1ie/ 83 | # ie 84 | - derive/([jqx])ie$/$1ei/ 85 | # ao 86 | - derive/([rtypsdghklzcbnm])ao$/$1oa/ 87 | # ou 88 | - derive/([ypfm])ou$/$1uo/ 89 | # uo(无) 90 | # an 91 | - derive/([wrtypsdfghklzcbnm])an$/$1na/ 92 | # en 93 | - derive/([wrpsdfghklzcbnm])en$/$1ne/ 94 | # ang 95 | - derive/([wrtypsdfghklzcbnm])ang$/$1nag/ 96 | - derive/([wrtypsdfghklzcbnm])ang$/$1agn/ 97 | # eng 98 | - derive/([wrtpsdfghklzcbnm])eng$/$1neg/ 99 | - derive/([wrtpsdfghklzcbnm])eng$/$1egn/ 100 | # ing 101 | - derive/([qtypdjlxbnm])ing$/$1nig/ 102 | - derive/([qtypdjlxbnm])ing$/$1ign/ 103 | # ong 104 | - derive/([rtysdghklzcn])ong$/$1nog/ 105 | - derive/([rtysdghklzcn])ong$/$1ogn/ 106 | # iao 107 | - derive/([qtpdjlxbnm])iao$/$1ioa/ 108 | - derive/([qtpdjlxbnm])iao$/$1oia/ 109 | # ui 110 | - derive/([rtsghkzc])ui$/$1iu/ 111 | # iu 112 | - derive/([qjlxnm])iu$/$1ui/ 113 | # ian 114 | - derive/([qtpdjlxbnm])ian$/$1ain/ 115 | # - derive/([qtpdjlxbnm])ian$/$1ina/ # 和「李娜、蒂娜、缉拿」等常用词有冲突 116 | # in 117 | - derive/([qypjlxbnm])in$/$1ni/ 118 | # iang 119 | - derive/([qjlxn])iang$/$1aing/ 120 | - derive/([qjlxn])iang$/$1inag/ 121 | # ua 122 | - derive/([g|k|h|zh|sh])ua$/$1au/ 123 | # uai 124 | - derive/([g|h|k|zh|ch|sh])uai$/$1aui/ 125 | - derive/([g|h|k|zh|ch|sh])uai$/$1uia/ 126 | # uan 127 | - derive/([qrtysdghjklzxcn])uan$/$1aun/ 128 | # - derive/([qrtysdghjklzxcn])uan$/$1una/ # 和「去哪、露娜」等常用词有冲突 129 | # un 130 | - derive/([qrtysdghjklzxc])un$/$1nu/ 131 | # ue 132 | - derive/([nlyjqx])ue$/$1eu/ 133 | # uang 134 | - derive/([g|h|k|zh|ch|sh])uang$/$1aung/ 135 | - derive/([g|h|k|zh|ch|sh])uang$/$1uagn/ 136 | - derive/([g|h|k|zh|ch|sh])uang$/$1unag/ 137 | - derive/([g|h|k|zh|ch|sh])uang$/$1augn/ 138 | # iong 139 | - derive/([jqx])iong$/$1inog/ 140 | - derive/([jqx])iong$/$1oing/ 141 | - derive/([jqx])iong$/$1iogn/ 142 | - derive/([jqx])iong$/$1oign/ 143 | # 其他 144 | - derive/([rtsdghkzc])o(u|ng)$/$1o/ # do → dou|dong 145 | - derive/ong$/on/ # lon → long 146 | - derive/([tl])eng$/$1en/ # ten → teng 147 | - derive/([qwrtypsdfghjklzxcbnm])([aeio])ng$/$1ng/ # lng → lang、leng、ling、long 148 | -------------------------------------------------------------------------------- /custom/squirrel.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | # ascii_mode、inline、no_inline、vim_mode 等等设定,可参考 /Library/Input Methods/Squirrel.app/Contents/SharedSupport/squirrel.yaml 3 | app_options: 4 | #com.raycast.macos: 5 | # ascii_mode: true # 初始爲西文模式 6 | #com.microsoft.VSCode: 7 | # ascii_mode: true # 初始爲西文模式 8 | # vim_mode: true 9 | #md.obsidian: 10 | # ascii_mode: true # 初始爲西文模式 11 | # vim_mode: true 12 | #org.alacritty: 13 | # ascii_mode: true # 初始爲西文模式 14 | #com.jetbrains.intellij: 15 | # ascii_mode: true 16 | # vim_mode: true 17 | 18 | style: 19 | # 选择皮肤,亮色与暗色主题 20 | # color_scheme: purity_of_form_custom 21 | # color_scheme_dark: purity_of_form_custom 22 | # color_scheme: macos_light 23 | # color_scheme_dark: macos_dark 24 | color_scheme: mac_light 25 | color_scheme_dark: mac_dark 26 | 27 | # 预设选项:(可被皮肤覆盖;如果皮肤没写,则默认使用这些属性。) 28 | text_orientation: horizontal # horizontal | vertical 29 | candidate_list_layout: linear 30 | inline_preedit: true 31 | corner_radius: 10 32 | hilited_corner_radius: 0 33 | border_height: 0 34 | border_width: 0 35 | line_spacing: 5 36 | spacing: 10 37 | #candidate_format: '%c. %@' 38 | #base_offset: 6 39 | font_face: "Lucida Grande" 40 | font_point: 21 41 | #label_font_face: 'Lucida Grande' 42 | label_font_point: 18 43 | #comment_font_face: 'Lucida Grande' 44 | comment_font_point: 18 45 | 46 | # 皮肤列表 47 | preset_color_schemes: 48 | macos_light: 49 | name: "MacOS 浅色/MacOS Light" 50 | author: 小码哥 51 | font_face: "PingFangSC" # 字体及大小 52 | font_point: 16 53 | label_font_face: "PingFangSC" # 序号字体及大小 54 | label_font_point: 12 55 | comment_font_face: "PingFangSC" # 注字体及大小 56 | comment_font_point: 16 57 | candidate_format: "%c\u2005%@\u2005" # 编号 %c 和候选词 %@ 前后的空间 58 | candidate_list_layout: linear # 候选排布:层叠 stacked | 行 linear 59 | text_orientation: horizontal # 行文向: 横 horizontal | 纵 vertical 60 | inline_preedit: true # 拼音位于: 候选框 false | 行内 true 61 | translucency: false # 磨砂: false | true 62 | mutual_exclusive: false # 色不叠加: false | true 63 | border_height: 1 # 外边框 高 64 | border_width: 1 # 外边框 宽 65 | corner_radius: 5 # 外边框 圆角半径 66 | hilited_corner_radius: 5 # 选中框 圆角半径 67 | surrounding_extra_expansion: 0 # 候选项背景相对大小? 68 | shadow_size: 0 # 阴影大小 69 | line_spacing: 5 # 行间距 70 | base_offset: 0 # 字基高 71 | alpha: 1 # 透明度,0~1 72 | spacing: 10 # 拼音与候选项之间的距离 (inline_preedit: false) 73 | color_space: srgb # 色彩空间: srgb | display_p3 74 | back_color: 0xFFFFFF # 底色 75 | hilited_candidate_back_color: 0xD75A00 # 选中底色 76 | label_color: 0x999999 # 序号颜色 77 | hilited_candidate_label_color: 0xFFFFFF # 选中序号颜色 78 | candidate_text_color: 0x3c3c3c # 文字颜色 79 | hilited_candidate_text_color: 0xFFFFFF # 选中文字颜色 80 | comment_text_color: 0x999999 # 注颜色 81 | hilited_comment_text_color: 0xFFFFFF # 选中注颜色 82 | text_color: 0x424242 # 拼音颜色 (inline_preedit: false) 83 | hilited_text_color: 0xFFFFFF # 选中拼音颜色 (inline_preedit: false) 84 | candidate_back_color: 0xFFFFFF # 候选项底色 85 | # preedit_back_color: # 拼音底色 (inline_preedit: false) 86 | hilited_back_color: 0xD75A00 # 选中拼音底色 (inline_preedit: false) 87 | border_color: 0xFFFFFF # 外边框颜色 88 | 89 | macos_dark: 90 | name: "MacOS 深色/MacOS Dark" 91 | author: 小码哥 92 | font_face: "PingFangSC" # 字体及大小 93 | font_point: 16 94 | label_font_face: "PingFangSC" # 序号字体及大小 95 | label_font_point: 12 96 | comment_font_face: "PingFangSC" # 注字体及大小 97 | comment_font_point: 16 98 | candidate_format: "%c\u2005%@\u2005" # 编号 %c 和候选词 %@ 前后的空间 99 | candidate_list_layout: linear # 候选排布:层叠 stacked | 行 linear 100 | text_orientation: horizontal # 行文向: 横 horizontal | 纵 vertical 101 | inline_preedit: true # 拼音位于: 候选框 false | 行内 true 102 | translucency: false # 磨砂: false | true 103 | mutual_exclusive: false # 色不叠加: false | true 104 | border_height: 1 # 外边框 高 105 | border_width: 1 # 外边框 宽 106 | corner_radius: 5 # 外边框 圆角半径 107 | hilited_corner_radius: 5 # 选中框 圆角半径 108 | surrounding_extra_expansion: 0 # 候选项背景相对大小? 109 | shadow_size: 0 # 阴影大小 110 | line_spacing: 5 # 行间距 111 | base_offset: 0 # 字基高 112 | alpha: 1 # 透明度,0~1 113 | spacing: 10 # 拼音与候选项之间的距离 (inline_preedit: false) 114 | color_space: srgb # 色彩空间: srgb | display_p3 115 | back_color: 0x1f1e2d # 底色 116 | hilited_candidate_back_color: 0xD75A00 # 选中底色 117 | label_color: 0x999999 # 序号颜色 118 | hilited_candidate_label_color: 0xFFFFFF # 选中序号颜色 119 | candidate_text_color: 0xe9e9ea # 文字颜色 120 | hilited_candidate_text_color: 0xFFFFFF # 选中文字颜色 121 | comment_text_color: 0x999999 # 注颜色 122 | hilited_comment_text_color: 0x999999 # 选中注颜色 123 | text_color: 0x808080 # 拼音颜色 (inline_preedit: false) 124 | hilited_text_color: 0xFFFFFF # 选中拼音颜色 (inline_preedit: false) 125 | candidate_back_color: 0x1f1e2d # 候选项底色 126 | # preedit_back_color: # 拼音底色 (inline_preedit: false) 127 | hilited_back_color: 0xD75A00 # 选中拼音底色 (inline_preedit: false) 128 | border_color: 0x050505 # 外边框颜色 129 | 130 | wechat_light: 131 | name: "微信浅色/Wechat Light" 132 | author: 小码哥 133 | font_face: "PingFangSC" # 字体及大小 134 | font_point: 16 135 | label_font_face: "PingFangSC" # 序号字体及大小 136 | label_font_point: 13 137 | comment_font_face: "PingFangSC" # 注字体及大小 138 | comment_font_point: 16 139 | candidate_format: "%c\u2005%@\u2005" # 编号 %c 和候选词 %@ 前后的空间 140 | candidate_list_layout: linear # 候选排布:层叠 stacked | 行 linear 141 | text_orientation: horizontal # 行文向: 横 horizontal | 纵 vertical 142 | inline_preedit: true # 拼音位于: 候选框 false | 行内 true 143 | translucency: false # 磨砂: false | true 144 | mutual_exclusive: false # 色不叠加: false | true 145 | border_height: 1 # 外边框 高 146 | border_width: 1 # 外边框 宽 147 | corner_radius: 5 # 外边框 圆角半径 148 | hilited_corner_radius: 5 # 选中框 圆角半径 149 | surrounding_extra_expansion: 0 # 候选项背景相对大小? 150 | shadow_size: 0 # 阴影大小 151 | line_spacing: 5 # 行间距 152 | base_offset: 0 # 字基高 153 | alpha: 1 # 透明度,0~1 154 | spacing: 10 # 拼音与候选项之间的距离 (inline_preedit: false) 155 | color_space: srgb # 色彩空间: srgb | display_p3 156 | back_color: 0xFFFFFF # 底色 157 | hilited_candidate_back_color: 0x79af22 # 选中底色 158 | label_color: 0x999999 # 序号颜色 159 | hilited_candidate_label_color: 0xFFFFFF # 选中序号颜色 160 | candidate_text_color: 0x3c3c3c # 文字颜色 161 | hilited_candidate_text_color: 0xFFFFFF # 选中文字颜色 162 | comment_text_color: 0x999999 # 注颜色 163 | hilited_comment_text_color: 0x999999 # 选中注颜色 164 | text_color: 0x424242 # 拼音颜色 (inline_preedit: false) 165 | hilited_text_color: 0x999999 # 选中拼音颜色 (inline_preedit: false) 166 | candidate_back_color: 0xFFFFFF # 候选项底色 167 | # preedit_back_color: # 拼音底色 (inline_preedit: false) 168 | hilited_back_color: 0x79af22 # 选中拼音底色 (inline_preedit: false) 169 | border_color: 0xFFFFFF # 外边框颜色 170 | 171 | wechat_dark: 172 | name: "微信深色/Wechat Dark" 173 | author: 小码哥 174 | font_face: "PingFangSC" # 字体及大小 175 | font_point: 16 176 | label_font_face: "PingFangSC" # 序号字体及大小 177 | label_font_point: 13 178 | comment_font_face: "PingFangSC" # 注字体及大小 179 | comment_font_point: 16 180 | candidate_format: "%c\u2005%@\u2005" # 编号 %c 和候选词 %@ 前后的空间 181 | candidate_list_layout: linear # 候选排布:层叠 stacked | 行 linear 182 | text_orientation: horizontal # 行文向: 横 horizontal | 纵 vertical 183 | inline_preedit: true # 拼音位于: 候选框 false | 行内 true 184 | translucency: false # 磨砂: false | true 185 | mutual_exclusive: false # 色不叠加: false | true 186 | border_height: 1 # 外边框 高 187 | border_width: 1 # 外边框 宽 188 | corner_radius: 5 # 外边框 圆角半径 189 | hilited_corner_radius: 5 # 选中框 圆角半径 190 | surrounding_extra_expansion: 0 # 候选项背景相对大小? 191 | shadow_size: 0 # 阴影大小 192 | line_spacing: 5 # 行间距 193 | base_offset: 0 # 字基高 194 | alpha: 1 # 透明度,0~1 195 | spacing: 10 # 拼音与候选项之间的距离 (inline_preedit: false) 196 | color_space: srgb # 色彩空间: srgb | display_p3 197 | back_color: 0x151515 # 底色 198 | hilited_candidate_back_color: 0x79af22 # 选中底色 199 | label_color: 0x999999 # 序号颜色 200 | hilited_candidate_label_color: 0xFFFFFF # 选中序号颜色 201 | candidate_text_color: 0xbbbbbb # 文字颜色 202 | hilited_candidate_text_color: 0xFFFFFF # 选中文字颜色 203 | comment_text_color: 0x999999 # 注颜色 204 | hilited_comment_text_color: 0xFFFFFF # 选中注颜色 205 | text_color: 0xbbbbbb # 拼音颜色 (inline_preedit: false) 206 | hilited_text_color: 0x999999 # 选中拼音颜色 (inline_preedit: false) 207 | candidate_back_color: 0x151515 # 候选项底色 208 | # preedit_back_color: # 拼音底色 (inline_preedit: false) 209 | hilited_back_color: 0x79af22 # 选中拼音底色 (inline_preedit: false) 210 | border_color: 0x292929 # 外边框颜色 211 | 212 | mac_light: 213 | name: Mac浅色 214 | horizontal: true # true横排,false竖排 215 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 216 | corner_radius: 5 # 窗口圆角 217 | hilited_corner_radius: 5 # 高亮圆角 218 | line_spacing: 10 # 行间距(适用于竖排) 219 | border_height: 4 # 窗口上下高度,大于圆角半径才生效 220 | border_width: 4 # 窗口左右宽度,大于圆角半径才生效 221 | font_face: "PingFangSC" # 候选词字体 222 | font_point: 21 # 候选字大小 223 | label_font_point: 13 # 候选编号大小 224 | text_color: 0x424242 # 拼音行文字颜色 225 | back_color: 0xFFFFFF # 候选条背景色 226 | border_color: 0xFFFFFF # 边框色 227 | label_color: 0x999999 # 预选栏编号颜色 228 | candidate_text_color: 0x3c3c3c # 预选项文字颜色 229 | comment_text_color: 0x999999 # 拼音等提示文字颜色 230 | hilited_text_color: 0x999999 # 高亮拼音 (需要开启内嵌编码) 231 | hilited_back_color: 0xD75A00 # 第一候选项背景背景色 232 | hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色 233 | hilited_candidate_label_color: 0xFFFFFF # 第一候选项编号颜色 234 | hilited_comment_text_color: 0x999999 # 注解文字高亮 235 | mac_dark: 236 | name: Mac深色 237 | horizontal: true # true横排,false竖排 238 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 239 | corner_radius: 5 # 窗口圆角 240 | hilited_corner_radius: 5 # 高亮圆角 241 | line_spacing: 10 # 行间距(适用于竖排) 242 | border_height: 4 # 窗口上下高度,大于圆角半径才生效 243 | border_width: 4 # 窗口左右宽度,大于圆角半径才生效 244 | font_face: "PingFangSC" # 候选词字体 245 | font_point: 21 # 候选字大小 246 | label_font_point: 13 # 候选编号大小 247 | text_color: 0x424242 # 拼音行文字颜色 248 | back_color: 0x252a2e # 候选条背景色 249 | border_color: 0x050505 # 边框色 250 | label_color: 0x999999 # 预选栏编号颜色 251 | candidate_text_color: 0xe9e9ea # 预选项文字颜色 252 | comment_text_color: 0x999999 # 拼音等提示文字颜色 253 | hilited_text_color: 0x999999 # 高亮拼音 (需要开启内嵌编码) 254 | hilited_back_color: 0xD75A00 # 第一候选项背景背景色 255 | hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色 256 | hilited_candidate_label_color: 0xFFFFFF # 第一候选项编号颜色 257 | hilited_comment_text_color: 0x999999 # 注解文字高亮 258 | 259 | mac_green: 260 | name: Mac绿色 261 | horizontal: true # true横排,false竖排 262 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 263 | corner_radius: 5 # 窗口圆角 264 | hilited_corner_radius: 5 # 高亮圆角 265 | line_spacing: 10 # 行间距(适用于竖排) 266 | border_height: 4 # 窗口上下高度,大于圆角半径才生效 267 | border_width: 4 # 窗口左右宽度,大于圆角半径才生效 268 | font_face: "PingFangSC" # 候选词字体 269 | font_point: 21 # 候选字大小 270 | label_font_point: 13 # 候选编号大小 271 | text_color: 0x424242 # 拼音行文字颜色 272 | back_color: 0xFFFFFF # 候选条背景色 273 | border_color: 0xFFFFFF # 边框色 274 | label_color: 0x999999 # 预选栏编号颜色 275 | candidate_text_color: 0x3c3c3c # 预选项文字颜色 276 | comment_text_color: 0x999999 # 拼音等提示文字颜色 277 | hilited_text_color: 0x999999 # 高亮拼音 (需要开启内嵌编码) 278 | hilited_candidate_back_color: 0x32A14C # 第一候选项背景色 279 | hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色 280 | hilited_candidate_label_color: 0xFFFFFF # 第一候选项编号颜色 281 | hilited_comment_text_color: 0x999999 # 注解文字高亮 282 | 283 | mac_orange: 284 | name: Mac橙色 285 | horizontal: true # true横排,false竖排 286 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 287 | corner_radius: 5 # 窗口圆角 288 | hilited_corner_radius: 5 # 高亮圆角 289 | line_spacing: 10 # 行间距(适用于竖排) 290 | border_height: 4 # 窗口上下高度,大于圆角半径才生效 291 | border_width: 4 # 窗口左右宽度,大于圆角半径才生效 292 | font_face: "PingFangSC" # 候选词字体 293 | font_point: 21 # 候选字大小 294 | label_font_point: 13 # 候选编号大小 295 | text_color: 0x424242 # 拼音行文字颜色 296 | back_color: 0xFFFFFF # 候选条背景色 297 | border_color: 0xFFFFFF # 边框色 298 | label_color: 0x999999 # 预选栏编号颜色 299 | candidate_text_color: 0x3c3c3c # 预选项文字颜色 300 | comment_text_color: 0x999999 # 拼音等提示文字颜色 301 | hilited_text_color: 0x999999 # 高亮拼音 (需要开启内嵌编码) 302 | hilited_candidate_back_color: 0x0E6BD8 # 第一候选项背景色 303 | hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色 304 | hilited_candidate_label_color: 0xFFFFFF # 第一候选项编号颜色 305 | hilited_comment_text_color: 0x999999 # 注解文字高亮 306 | 307 | mac_blue: 308 | name: Mac浅蓝 309 | horizontal: true # true横排,false竖排 310 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 311 | corner_radius: 5 # 窗口圆角 312 | font_face: "PingFangSC" # 候选词字体 313 | font_point: 21 # 候选字大小 314 | label_font_point: 13 # 候选编号大小 315 | line_spacing: 10 # 行间距(适用于竖排) 316 | text_color: 0x424242 # 拼音行文字颜色 317 | back_color: 0xFFFFFF # 候选条背景色 318 | border_color: 0xFFFFFF # 边框色 319 | label_color: 0x999999 # 预选栏编号颜色 320 | candidate_text_color: 0x3c3c3c # 预选项文字颜色 321 | comment_text_color: 0x999999 # 拼音等提示文字颜色 322 | hilited_text_color: 0x999999 # 高亮拼音 (需要开启内嵌编码) 323 | hilited_back_color: 0xF8AA4D # 第一候选项背景背景色 324 | hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色 325 | hilited_candidate_label_color: 0xFFFFFF # 第一候选项编号颜色 326 | hilited_comment_text_color: 0x999999 # 注解文字高亮 327 | 328 | psionics: 329 | name: 幽能 330 | horizontal: true # true横排,false竖排 331 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 332 | corner_radius: 5 # 窗口圆角 333 | font_point: 21 # 候选文字大小 334 | label_font_point: 14 # 候选编号大小 335 | font_face: "PingFangSC-Regular,HanaMinB" # 候选词字体 336 | line_spacing: 10 # 行间距(适用于竖排) 337 | text_color: 0xc2c2c2 # 拼音行文字颜色 338 | back_color: 0x444444 # 候选条背景色,24位色值,16进制,BGR顺序 339 | candidate_text_color: 0xeeeeee # 预选项文字颜色 340 | hilited_candidate_back_color: 0xd4bc00 # 候选文字背景色 341 | comment_text_color: 0x808080 # 拼音等提示文字颜色 342 | hilited_text_color: 0xeeeeee # 高亮拼音 (需要开启内嵌编码) 343 | hilited_back_color: 0x444444 # 第一候选项背景背景色 344 | hilited_candidate_label_color: 0xfafafa # 第一候选项编号颜色 345 | hilited_candidate_text_color: 0xfafafa # 第一候选项文字颜色 346 | hilited_comment_text_color: 0x444444 # 注解文字高亮 347 | 348 | win10: 349 | horizontal: true # true横排,false竖排 350 | candidate_format: "%c %@ " # 如果是竖排建议改为 "%c\u2005%@" 351 | font_point: 17 # 候选文字大小 352 | label_font_point: 16 # 候选编号大小 353 | corner_radius: 0 # 候选条圆角 354 | border_width: 6 # 窗口左右宽度 355 | border_height: 6 # 窗口左右高度 356 | margin_x: 12 # 字起始距左边距离 357 | margin_y: 12 # 字上下边距 358 | spacing: 10 # 间距 359 | candidate_spacing: 24 # 候选字间隔 360 | line_spacing: 10 # 行间距(适用于竖排) 361 | hilite_spacing: 8 # 序号和候选字之间的间隔 362 | hilite_padding: 12 # 候选字背景色色块高度 若想候选字背景色块无边界填充候选框,仅需其高度和候选字上下边距一致即可 363 | round_corner: 0 # 候选字背景色块圆角幅度 364 | candidate_text_color: 0x000000 # 预选项文字颜色 365 | comment_text_color: 0x888888 # 拼音等提示文字颜色 366 | text_color: 0x000000 # 拼音行文字颜色 367 | back_color: 0xffffff # 候选条背景色,24位色值,16进制,BGR顺序 368 | hilited_text_color: 0x000000 # 高亮拼音 (需要开启内嵌编码) 369 | hilited_back_color: 0xffffff # 第一候选项背景背景色 370 | hilited_candidate_text_color: 0xffffff # 第一候选项文字颜色 371 | hilited_candidate_back_color: 0xcc8f29 # 候选文字背景色 372 | hilited_comment_text_color: 0xffffff # 注解文字高亮 373 | hilited_label_color: 0xffffff # 已选字的数字的颜色 374 | label_color: 0x888888 # 预选栏编号颜色 375 | 376 | solarized_rock: 377 | name: 日光石 378 | horizontal: true # true横排,false竖排 379 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 380 | corner_radius: 6 # 窗口圆角 381 | font_point: 21 # 候选文字大小 382 | label_font_point: 15 # 候选编号大小 383 | line_spacing: 10 # 行间距(适用于竖排) 384 | font_face: "PingFangSC-Regular,HanaMinB" # 候选词字体 385 | text_color: 0x8236d3 # 拼音行文字颜色 386 | back_color: 0x362b00 # 候选条背景色,24位色值,16进制,BGR顺序 387 | candidate_text_color: 0x969483 # 预选项文字颜色 388 | comment_text_color: 0xc098a12a # 拼音等提示文字颜色 389 | hilited_text_color: 0x98a12a # 高亮拼音 (需要开启内嵌编码) 390 | hilited_back_color: 0x444444 # 第一候选项背景背景色 391 | hilited_candidate_label_color: 0xfafafa # 第一候选项编号颜色 392 | hilited_candidate_back_color: 0x8236d3 # 候选文字背景色 393 | hilited_candidate_text_color: 0xffffff # 第一候选项文字颜色 394 | hilited_comment_text_color: 0x362b00 # 注解文字高亮 395 | 396 | solarized_dark: 397 | name: 夜光石 398 | horizontal: true # true横排,false竖排 399 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 400 | corner_radius: 6 # 窗口圆角 401 | font_point: 21 # 候选文字大小 402 | label_font_point: 15 # 候选编号大小 403 | line_spacing: 10 # 行间距(适用于竖排) 404 | font_face: "PingFangSC-Regular,HanaMinB" # 候选词字体 405 | text_color: 0xA1A095 # 拼音行文字颜色 406 | border_color: 0xf02A1F00 # 边框颜色 407 | label_color: 0xCC8947 # 预选栏编号颜色 408 | back_color: 0xf0352A0A # 候选条背景色,24位色值,16进制,BGR顺序 409 | candidate_text_color: 0x989F52 # 预选项文字颜色 410 | comment_text_color: 0x289989 # 拼音等提示文字颜色 411 | hilited_text_color: 0x2C8BAE # 高亮拼音 (需要开启内嵌编码) 412 | hilited_back_color: 0x444444 # 第一候选项背景背景色 413 | hilited_candidate_label_color: 0x2566C6 # 第一候选项编号颜色 414 | hilited_candidate_back_color: 0xD7E8ED # 候选文字背景色 415 | hilited_candidate_text_color: 0x3942CB # 第一候选项文字颜色 416 | hilited_comment_text_color: 0x8144C2 # 注解文字高亮 417 | 418 | apathy: 419 | name: 冷漠 420 | horizontal: true # true横排,false竖排 421 | back_color: 0xFFFFFF # 候选条背景色,24位色值,16进制,BGR顺序 422 | border_height: 0 # 窗口上下高度,大于圆角半径才生效 423 | border_width: 8 # 窗口左右宽度 424 | line_spacing: 10 # 行间距(适用于竖排) 425 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 426 | comment_text_color: 0x999999 # 拼音等提示文字颜色 427 | corner_radius: 5 # 窗口圆角 428 | font_point: 17 # 候选文字大小 429 | hilited_candidate_back_color: 0xFFF0E4 # 候选文字背景色 430 | hilited_candidate_text_color: 0xEE6E00 # 第一候选项文字颜色 431 | inline_preedit: true 432 | label_font_point: 12 # 候选编号大小 433 | text_color: 0x424242 # 拼音行文字颜色 434 | 435 | google: 436 | name: 谷歌 437 | horizontal: true # true横排,false竖排 438 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 439 | font_point: 21 # 候选文字大小 440 | label_font_point: 15 # 候选编号大小 441 | corner_radius: 6 # 窗口圆角 442 | line_spacing: 10 # 行间距(适用于竖排) 443 | text_color: 0x666666 # 拼音行文字颜色 444 | candidate_text_color: 0x000000 # 预选项文字颜色 445 | back_color: 0xFFFFFF # 候选条背景色,24位色值,16进制,BGR顺序 446 | border_color: 0xE2E2E2 # 边框 447 | hilited_text_color: 0x000000 # 高亮拼音 (需要开启内嵌编码) 448 | hilited_back_color: 0xFFFFFF # 第一候选项背景背景色 449 | hilited_candidate_text_color: 0xffffff # 第一候选项文字颜色 450 | hilited_candidate_back_color: 0xCE7539 # 候选文字背景色 451 | comment_text_color: 0x6D6D6D # 拼音等提示文字颜色 452 | hilited_comment_text_color: 0xEBC6B0 # 注解文字高亮 453 | hilited_candidate_label_color: 0xfafafa # 第一候选项编号颜色 454 | 455 | milan: 456 | name: 米兰 457 | horizontal: true # true横排,false竖排 458 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 459 | font_point: 21 # 候选文字大小 460 | label_font_point: 14 # 候选编号大小 461 | line_spacing: 10 # 行间距(适用于竖排) 462 | border_height: 4 # 窗口上下高度,大于圆角半径才生效 463 | border_width: 4 # 窗口左右宽度,大于圆角半径才生效 464 | corner_radius: 5 # 窗口圆角 465 | back_color: 0xFFFFFF # 候选条背景色 466 | comment_text_color: 0x999999 # 拼音等提示文字颜色 467 | hilited_candidate_back_color: 0xF5803B # 候选文字背景色 468 | hilited_candidate_text_color: 0xFFFFFF # 第一候选项文字颜色 469 | text_color: 0x424242 # 拼音行文字颜色 470 | 471 | ink: 472 | name: 墨池 473 | horizontal: true # true横排,false竖排 474 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 475 | font_point: 21 # 候选文字大小 476 | label_font_point: 14 # 候选编号大小 477 | corner_radius: 5 # 窗口圆角 478 | line_spacing: 10 # 行间距(适用于竖排) 479 | text_color: 0x5a5a5a # 拼音等提示文字颜色 480 | back_color: 0xeeffffff # 候选条背景色 481 | candidate_text_color: 0x000000 # 第一候选项文字颜色 482 | hilited_text_color: 0x000000 # 高亮拼音 (需要开启内嵌编码) 483 | hilited_candidate_text_color: 0xffffff # 第一候选项文字颜色 484 | hilited_candidate_back_color: 0xcc000000 # 候选文字背景色 485 | comment_text_color: 0x5a5a5a # 拼音等提示文字颜色 486 | hilited_comment_text_color: 0x808080 # 注解文字高亮 487 | 488 | purity: 489 | name: 纯洁 490 | horizontal: true # true横排,false竖排 491 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 492 | font_point: 21 # 候选文字大小 493 | label_font_point: 14 # 候选编号大小 494 | corner_radius: 5 # 窗口圆角 495 | line_spacing: 10 # 行间距(适用于竖排) 496 | text_color: 0xc2c2c2 # 拼音等提示文字颜色 497 | back_color: 0x444444 # 候选条背景色 498 | candidate_text_color: 0xeeeeee # 第一候选项文字颜色 499 | hilited_text_color: 0xeeeeee # 高亮拼音 (需要开启内嵌编码) 500 | hilited_back_color: 0x444444 # 第一候选项背景背景色 501 | hilited_candidate_text_color: 0x000000 # 第一候选项文字颜色 502 | hilited_candidate_back_color: 0xfafafa # 候选文字背景色 503 | comment_text_color: 0x808080 # 拼音等提示文字颜色 504 | 505 | starcraft: 506 | name: 星际争霸 507 | horizontal: true # true横排,false竖排 508 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 509 | font_point: 21 # 候选文字大小 510 | label_font_point: 14 # 候选编号大小 511 | corner_radius: 5 # 窗口圆角 512 | line_spacing: 10 # 行间距(适用于竖排) 513 | text_color: 0xccaa88 # 拼音等提示文字颜色 514 | candidate_text_color: 0x30bb55 # 第一候选项文字颜色 515 | back_color: 0xee000000 # 候选条背景色 516 | border_color: 0x1010a0 # 边框色 517 | hilited_text_color: 0xfecb96 # 高亮拼音 (需要开启内嵌编码) 518 | hilited_back_color: 0x000000 # 第一候选项背景背景色 519 | hilited_candidate_text_color: 0x70ffaf # 第一候选项文字颜色 520 | hilited_candidate_back_color: 0x000000 # 候选文字背景色 521 | comment_text_color: 0x1010d0 # 拼音等提示文字颜色 522 | hilited_comment_text_color: 0x1010f0 # 注解文字高亮 523 | 524 | nord_light: 525 | name: 北方浅色 526 | horizontal: true # true横排,false竖排 527 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 528 | font_point: 21 # 候选文字大小 529 | label_font_point: 14 # 候选编号大小 530 | corner_radius: 5 # 窗口圆角 531 | line_spacing: 10 # 行间距(适用于竖排) 532 | back_color: 0xF4EFEC # 候选条背景色 533 | border_color: 0xF4EFEC # 边框色 534 | candidate_text_color: 0xC1A181 # 第一候选项文字颜色 535 | comment_text_color: 0xD0C088 # 拼音等提示文字颜色 536 | hilited_back_color: 0xF0E9E5 # 第一候选项背景背景色 537 | hilited_candidate_back_color: 0xE9DED8 # 候选文字背景色 538 | hilited_candidate_text_color: 0xAC815E # 第一候选项文字颜色 539 | hilited_text_color: 0xAD8EB4 # 高亮拼音 (需要开启内嵌编码) 540 | text_color: 0x7087D0 # 拼音等提示文字颜色 541 | 542 | nord_dark: 543 | name: 北方深色 544 | horizontal: true # true横排,false竖排 545 | candidate_format: "%c %@ " # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间 546 | font_point: 21 # 候选文字大小 547 | label_font_point: 14 # 候选编号大小 548 | corner_radius: 5 # 窗口圆角 549 | line_spacing: 10 # 行间距(适用于竖排) 550 | back_color: 0x473A33 # 候选条背景色 551 | border_color: 0x473A33 # 边框色 552 | candidate_text_color: 0xF5D887 # 第一候选项文字颜色 553 | comment_text_color: 0xE6B687 # 拼音等提示文字颜色 554 | hilited_back_color: 0x473A33 # 第一候选项背景背景色 555 | hilited_candidate_back_color: 0x5D4C43 # 候选文字背景色 556 | hilited_candidate_text_color: 0xC0E077 # 第一候选项文字颜色 557 | hilited_text_color: 0x6EC8F5 # 高亮拼音 (需要开启内嵌编码) 558 | text_color: 0x78E8F0 # 拼音等提示文字颜色 559 | -------------------------------------------------------------------------------- /custom/weasel.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | style: 3 | # color_scheme: ms_sogou 4 | color_scheme: ms_wechat_light 5 | # color_scheme: ms_wechat_dark 6 | 7 | font_face: "微软雅黑" 8 | font_point: 14 9 | horizontal: true 10 | inline_preedit: true 11 | label_font_point: 14 12 | layout: 13 | border: 2 14 | round_corner: 0 15 | margin_x: 5 16 | margin_y: 5 17 | hilite_padding: 5 18 | hilite_spacing: 5 19 | spacing: 5 20 | candidate_spacing: 20 21 | 22 | preset_color_schemes: 23 | ms_sogou: 24 | name: 搜狗 25 | author: Mark24Code 26 | back_color: 0xFFFFFF 27 | border_color: 0xFFFFFF 28 | text_color: 0xD9884F 29 | hilited_text_color: 0xD9884F 30 | hilited_back_color: 0xFFFFFF 31 | hilited_candidate_text_color: 0x0D4FE9 32 | hilited_candidate_back_color: 0xFFFFFF 33 | candidate_text_color: 0xD67F42 34 | comment_text_color: 0xFFFFFF 35 | 36 | ms_wechat_light: 37 | name: 微信light 38 | author: Mark24Code 39 | back_color: 0xFFFFFF 40 | border_color: 0xFFFFFF 41 | text_color: 0x69AD2E 42 | hilited_text_color: 0xFFFFFF 43 | hilited_back_color: 0x69AD2E 44 | hilited_candidate_text_color: 0xFFFFFF 45 | hilited_candidate_back_color: 0x69AD2E 46 | candidate_text_color: 0x69AD2E 47 | comment_text_color: 0xFFFFFF 48 | 49 | ms_wechat_dark: 50 | name: 微信dark 51 | author: Mark24Code 52 | back_color: 0x000000 53 | border_color: 0x000000 54 | text_color: 0x69AD2E 55 | hilited_text_color: 0xD8D8D8 56 | hilited_back_color: 0x69AD2E 57 | hilited_candidate_text_color: 0xD8D8D8 58 | hilited_candidate_back_color: 0x69AD2E 59 | candidate_text_color: 0x69AD2E 60 | comment_text_color: 0xFFFFFF -------------------------------------------------------------------------------- /deploy.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "./installer" 4 | -------------------------------------------------------------------------------- /images/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/result.png -------------------------------------------------------------------------------- /images/rime.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/rime.jpeg -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step1-install-ruby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step1-install-ruby.png -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step2-accept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step2-accept.png -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step3-default-path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step3-default-path.png -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step4-select-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step4-select-all.png -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step5-finished.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step5-finished.png -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step6-dev-chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step6-dev-chain.png -------------------------------------------------------------------------------- /images/windows/01-install-ruby/step7-install-ruby-success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/01-install-ruby/step7-install-ruby-success.png -------------------------------------------------------------------------------- /images/windows/04-install-rime/step1-default-path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/04-install-rime/step1-default-path.png -------------------------------------------------------------------------------- /images/windows/05-run-script/step1-quit-servce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/05-run-script/step1-quit-servce.png -------------------------------------------------------------------------------- /images/windows/05-run-script/step2-open-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/05-run-script/step2-open-terminal.png -------------------------------------------------------------------------------- /images/windows/05-run-script/step3-success-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/windows/05-run-script/step3-success-run.png -------------------------------------------------------------------------------- /images/working.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mark24Code/rime-auto-deploy/4823da8bc44598aa9b73de4bf902d3e065b66a79/images/working.png -------------------------------------------------------------------------------- /installer.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "./lib/core" 4 | require "./lib/config" 5 | require "./share/upgrade" 6 | 7 | module OSPatch 8 | def check_os 9 | case RUBY_PLATFORM.downcase 10 | when /darwin/ 11 | @osname = "MacOS" 12 | when /linux/ 13 | @osname = "LinuxDistro" 14 | when /mswin|win32|mingw|cygwin/ 15 | @osname = "Windows" 16 | else 17 | not_support_exit 18 | end 19 | end 20 | end 21 | module RimeDeploy 22 | class Installer 23 | include OSPatch 24 | def initialize 25 | @osname = nil 26 | check_os 27 | run 28 | end 29 | 30 | def not_support_exit 31 | puts "Not support this system. Bye~" 32 | exit 0 33 | end 34 | 35 | def run 36 | require "./os/#{@osname}" 37 | instance_eval("#{@osname}JobGroup.new.call") 38 | end 39 | end 40 | end 41 | 42 | RimeDeploy::Installer.new 43 | -------------------------------------------------------------------------------- /lib/config.rb: -------------------------------------------------------------------------------- 1 | module RimeDeploy 2 | module Config 3 | RIME_CONFIG_REPO = "https://github.com/iDvel/rime-ice.git" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/core.rb: -------------------------------------------------------------------------------- 1 | module FontStylePatch 2 | RESET_COLOR = "\e[0m" #重置所有颜色和样式 3 | COLORS = { 4 | black: "\e[30m", #黑色文本 5 | red: "\e[31m", #红色文本 6 | green: "\e[32m", #绿色文本 7 | yellow: "\e[33m", #黄色文本 8 | blue: "\e[34m", #蓝色文本 9 | carmine: "\e[35m", #洋红色文本 10 | cyan: "\e[36m", #青色文本 11 | white: "\e[37m" #白色文本 12 | } 13 | COLORS.keys.each do |color_name| 14 | define_method(color_name) do 15 | return "#{COLORS[color_name]}#{self}#{RESET_COLOR}" 16 | end 17 | end 18 | end 19 | 20 | module StringPatch 21 | def nature_case 22 | self.gsub(/(.)([A-Z])/, '\1 \2').downcase.capitalize 23 | end 24 | end 25 | 26 | class String 27 | include FontStylePatch 28 | include StringPatch 29 | end 30 | 31 | module RimeDeploy 32 | class RimeDeployError < StandardError 33 | end 34 | 35 | class ChooseSession 36 | def initialize(items) 37 | @items = items #[[intro, method]] auto index 38 | end 39 | 40 | def call 41 | message = nil 42 | choose = nil 43 | while true 44 | puts @title 45 | puts "Choose mode:" 46 | @items.each_with_index do |item, index| 47 | puts "[#{index + 1}] " + item[0] 48 | end 49 | puts "Tips: input the index. e.g: 1; Ctrl-C exit." 50 | puts "Message: #{message}".red if message 51 | print ">>".green 52 | choose_mode = gets 53 | choose_index = choose_mode.strip 54 | if choose_index =~ /\d+/ && choose_index.to_i <= @items.length 55 | choose = @items[choose_index.to_i - 1] 56 | break 57 | else 58 | message = "Wrong Index, try again." 59 | end 60 | end 61 | 62 | choose[1].call 63 | end 64 | end 65 | 66 | class Store 67 | @config_path = nil 68 | 69 | def self.config_path=(value) 70 | @config_path = value 71 | end 72 | 73 | def self.config_path 74 | @config_path 75 | end 76 | end 77 | 78 | class Job 79 | attr_accessor :status, :intro 80 | def initialize 81 | @status = :waiting # :waiting, :processing, :done, :fail 82 | klass_name = self.class.to_s.split("::").last.sub(/Job$/, "") 83 | @intro = klass_name.nature_case 84 | end 85 | 86 | def call 87 | end 88 | 89 | def rollback 90 | end 91 | end 92 | 93 | class JobGroup 94 | @jobs = [] 95 | @after_jobs = [] 96 | @before_jobs = [] 97 | 98 | def self.jobs 99 | @jobs 100 | end 101 | def self.jobs=(value) 102 | @jobs = value 103 | end 104 | 105 | def self.after_jobs 106 | @after_jobs 107 | end 108 | def self.after_jobs=(value) 109 | @after_jobs = value 110 | end 111 | 112 | def self.before_jobs 113 | @before_jobs 114 | end 115 | 116 | def self.before_jobs=(value) 117 | @before_jobs = value 118 | end 119 | 120 | def self.upgrade_jobs 121 | @upgrade_jobs 122 | end 123 | 124 | def self.upgrade_jobs=(value) 125 | @upgrade_jobs = value 126 | end 127 | 128 | def add_jobs_to_queue(jobs = nil) 129 | jobs.each { |job| @queue << job.new } if jobs 130 | end 131 | 132 | def add_before_jobs_to_queue(jobs = nil) 133 | jobs.each { |job| @before_jobs << job.new } if jobs 134 | end 135 | 136 | def add_after_jobs_to_queue(jobs = nil) 137 | jobs.each { |job| @after_jobs << job.new } 138 | end 139 | 140 | def initialize() 141 | @title = "=== Rime Deploy ====".green 142 | @before_jobs = [] 143 | @queue = [] 144 | @after_jobs = [] 145 | @current_index = 0 146 | 147 | add_before_jobs_to_queue(self.class.before_jobs) 148 | add_after_jobs_to_queue(self.class.after_jobs) 149 | end 150 | 151 | def clear_screen 152 | system("clear") 153 | end 154 | 155 | def print_progress 156 | clear_screen 157 | puts @title 158 | @queue.each_with_index do |job, index| 159 | job_id = "[%02d]" % (index + 1) 160 | job_intro = job.intro.to_s.ljust(20).green 161 | job_status = job.status 162 | case job_status 163 | when :waiting 164 | job_status = job_status.to_s.white 165 | when :processing 166 | job_status = job_status.to_s.yellow 167 | when :done 168 | job_status = job_status.to_s.green 169 | end 170 | job_status = job_status.rjust(15) 171 | puts "#{job_id} #{job_intro}\t#{job_status}" 172 | end 173 | 174 | if @current_index < @queue.length 175 | puts "Total: #{@queue.length}".ljust(10) 176 | puts "Detail " + "-" * 20 177 | end 178 | end 179 | 180 | def run_job_with_info_wrapper(current_job) 181 | print_progress 182 | begin 183 | result = current_job.call 184 | if result == :next 185 | current_job.status = :done 186 | @current_index += 1 187 | else 188 | # 失败处理 189 | current_job.rollback if current_job.respond_to? :rollback 190 | raise RimeDeployError 191 | end 192 | print_progress 193 | rescue RimeDeployError 194 | what_next 195 | end 196 | end 197 | 198 | def guidance 199 | puts @title 200 | puts "welcome to use Rime installer." 201 | ChooseSession.new( 202 | [ 203 | [ 204 | "Auto mode: Suitable for first-time operation.".green, 205 | -> { run_jobs_auto } 206 | ], 207 | [ 208 | "Handle mode: Decide to execute on your own.".green, 209 | -> { run_jobs_handle } 210 | ], 211 | [ 212 | "Upgrade mode: Suitable for upgrade exist Rime".green, 213 | -> { run_jobs_upgrade } 214 | ] 215 | ] 216 | ).call 217 | end 218 | 219 | def run_jobs_handle 220 | add_jobs_to_queue(self.class.jobs) 221 | halt_flag = 222 | catch :halt do 223 | clear_screen 224 | puts "[Handle Mode]".yellow 225 | handle_jobs = [] 226 | @queue.each_with_index do |job, index| 227 | job_intro = job.intro.to_s.ljust(20).green 228 | handle_jobs.push( 229 | ["#{job_intro}", -> { run_job_with_info_wrapper(job) }] 230 | ) 231 | end 232 | begin 233 | ChooseSession.new(handle_jobs).call 234 | rescue RimeDeployError 235 | what_next 236 | end 237 | end 238 | reset_queue 239 | run_jobs_handle if halt_flag == :handle_mode 240 | end 241 | 242 | def run_jobs_auto 243 | add_jobs_to_queue(self.class.jobs) 244 | clear_screen 245 | puts "[Auto Mode]".green 246 | print_progress 247 | halt_flag = 248 | catch :halt do 249 | while @current_index < @queue.length 250 | current_job = @queue[@current_index] 251 | current_job.status = :processing 252 | print_progress 253 | begin 254 | result = current_job.call 255 | if result == :next 256 | current_job.status = :done 257 | @current_index += 1 258 | else 259 | # 失败处理 260 | raise RimeDeployError 261 | end 262 | print_progress 263 | rescue RimeDeployError 264 | what_next 265 | end 266 | end 267 | end 268 | reset_queue 269 | run_jobs_handle if halt_flag == :handle_mode 270 | end 271 | 272 | def run_jobs_upgrade 273 | add_jobs_to_queue(self.class.upgrade_jobs) 274 | halt_flag = 275 | catch :halt do 276 | clear_screen 277 | puts "[Upgrade Mode]".yellow 278 | upgrade_jobs = [] 279 | @queue.each_with_index do |job, index| 280 | job_intro = job.intro.to_s.ljust(20).green 281 | upgrade_jobs.push( 282 | ["#{job_intro}", -> { run_job_with_info_wrapper(job) }] 283 | ) 284 | end 285 | begin 286 | ChooseSession.new(upgrade_jobs).call 287 | rescue RimeDeployError 288 | what_next 289 | end 290 | end 291 | reset_queue 292 | run_jobs_upgrade if halt_flag == :run_jobs_upgrade 293 | end 294 | 295 | def reset_queue 296 | @queue = [] 297 | end 298 | 299 | def reset_status 300 | @queue.each { |q| q.status = :waiting } 301 | end 302 | 303 | def what_next 304 | puts "" 305 | puts "Raise an error. Next, you want to...".red 306 | ChooseSession.new( 307 | [ 308 | ["Retry", -> {}], 309 | ["Change to: Handle mode", -> { throw :halt, :handle_mode }], 310 | ["Exit", -> { exit 0 }] 311 | ] 312 | ).call 313 | end 314 | 315 | def call 316 | @before_jobs.length > 0 && @before_jobs.each { |job| job.call } 317 | guidance 318 | @after_jobs.length > 0 && @after_jobs.each { |job| job.call } 319 | end 320 | end 321 | end 322 | -------------------------------------------------------------------------------- /os/LinuxDistro.rb: -------------------------------------------------------------------------------- 1 | module RimeDeploy 2 | class LinuxDistroJobGroup < JobGroup 3 | ConfigPathIbus = "~/.config/ibus/rime" 4 | ConfigPathFcitx = "~/.config/fcitx/rime" 5 | ConfigPathFcitx5 = "~/.local/share/fcitx5/rime" 6 | 7 | class CheckInstallRimeJob < Job 8 | def call 9 | puts "==== Rime auto deploy ====".green 10 | puts "Before Check Rime Installed Staus".yellow 11 | tips = <<-TIP 12 | Different Linux has it's own package manager. So make sure you had installed Rime before. 13 | 14 | For Fcitx5, install fcitx5-rime. 15 | For Fcitx, install fcitx-rime. 16 | For IBus, install ibus-rime. 17 | 18 | more: 19 | https://wiki.archlinux.org/title/Rime 20 | TIP 21 | puts tips 22 | puts "" 23 | puts "Then choose what your had installed." 24 | ChooseSession.new( 25 | [ 26 | [ 27 | "ibus-rime", 28 | -> { Store.config_path = LinuxDistroJobGroup::ConfigPathIbus } 29 | ], 30 | [ 31 | "fcitx-rime", 32 | -> { Store.config_path = LinuxDistroJobGroup::ConfigPathFcitx } 33 | ], 34 | [ 35 | "fcitx5-rime", 36 | -> { Store.config_path = LinuxDistroJobGroup::ConfigPathFcitx5 } 37 | ], 38 | [ 39 | "I'll quit first.After installed Rime by myself then run this program again.", 40 | -> { exit 0 } 41 | ] 42 | ] 43 | ).call 44 | sleep 1 45 | return :next 46 | end 47 | end 48 | 49 | class BackupRimeConfigJob < Job 50 | def call 51 | puts intro 52 | system( 53 | "mv #{Store.config_path} #{Store.config_path}.#{Time.now.to_i}.old" 54 | ) 55 | sleep 1 56 | return :next 57 | end 58 | end 59 | 60 | class CloneConfigJob < Job 61 | def call 62 | puts intro 63 | system( 64 | "git clone --depth=1 #{Config::RIME_CONFIG_REPO} #{Store.config_path}" 65 | ) 66 | sleep 1 67 | return :next 68 | end 69 | end 70 | 71 | class CopyCustomConfigJob < Job 72 | def call 73 | puts intro 74 | system("cp ./custom/*.yaml #{Store.config_path}/") 75 | sleep 1 76 | return :next 77 | end 78 | end 79 | 80 | class FinishedJob < Job 81 | def call 82 | puts "" 83 | puts "Tips: When finished all jobs. You need to do follow:".yellow 84 | puts "1) Restart system." 85 | puts "2) open Rime input method setting pane and click " + 86 | "DEPLOY".yellow + " button." 87 | puts "Enjoy~ 🍻" 88 | puts "more info:".yellow 89 | puts "Config path: #{Store.config_path}/" 90 | return :next 91 | end 92 | end 93 | self.before_jobs = [CheckInstallRimeJob] 94 | self.jobs = [BackupRimeConfigJob, CloneConfigJob, CopyCustomConfigJob] 95 | self.after_jobs = [FinishedJob] 96 | self.upgrade_jobs = [ 97 | Upgrade::UpgradeRimeAutoDeployJob, 98 | Upgrade::UpgradeRimeConfigJob 99 | ] 100 | end 101 | end 102 | -------------------------------------------------------------------------------- /os/MacOS.rb: -------------------------------------------------------------------------------- 1 | module RimeDeploy 2 | class MacOSJobGroup < JobGroup 3 | InstallCmd = "brew install --cask squirrel" 4 | Store.config_path = "~/Library/Rime" 5 | 6 | class InstallRimeJob < Job 7 | def call 8 | puts intro 9 | system(InstallCmd) 10 | sleep 1 11 | return :next 12 | end 13 | end 14 | 15 | class BackupRimeConfigJob < Job 16 | def call 17 | puts intro 18 | system( 19 | "mv #{Store.config_path} #{Store.config_path}.#{Time.now.to_i}.old" 20 | ) 21 | sleep 1 22 | return :next 23 | end 24 | end 25 | 26 | class CloneConfigJob < Job 27 | def call 28 | puts intro 29 | system( 30 | "git clone --depth=1 #{Config::RIME_CONFIG_REPO} #{Store.config_path}" 31 | ) 32 | sleep 1 33 | return :next 34 | end 35 | end 36 | 37 | class CopyCustomConfigJob < Job 38 | def call 39 | puts intro 40 | system("cp ./custom/*.yaml #{Store.config_path}/") 41 | sleep 1 42 | return :next 43 | end 44 | end 45 | 46 | class FinishedJob < Job 47 | def call 48 | puts "" 49 | puts "Tips: When finished all jobs. You need to do follow:".yellow 50 | puts "1) Restart system." 51 | puts "2) open Rime input method setting pane and click " + 52 | "DEPLOY".yellow + " button." 53 | puts "Enjoy~ 🍻" 54 | puts "more info:".yellow 55 | puts "Config path: #{Store.config_path}/" 56 | return :next 57 | end 58 | end 59 | 60 | self.jobs = [ 61 | InstallRimeJob, 62 | BackupRimeConfigJob, 63 | CloneConfigJob, 64 | CopyCustomConfigJob 65 | ] 66 | self.after_jobs = [FinishedJob] 67 | self.upgrade_jobs = [ 68 | Upgrade::UpgradeRimeAutoDeployJob, 69 | Upgrade::UpgradeRimeConfigJob 70 | ] 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /os/Windows.rb: -------------------------------------------------------------------------------- 1 | module RimeDeploy 2 | class WindowsJobGroup < JobGroup 3 | Store.config_path = ENV["APPDATA"] + '\\Rime' 4 | 5 | def clear_screen 6 | system("cls") 7 | end 8 | 9 | class CheckInstallRimeJob < Job 10 | def call 11 | puts "==== Rime auto deploy ====".green 12 | puts "Before Check Rime Installed Staus".yellow 13 | tips = <<-TIP 14 | Windows system doesn't have it's own package manager, so make sure you had installed Rime before. 15 | 16 | You can download Rime from: https://rime.im/download/ 17 | 18 | TIP 19 | puts tips 20 | puts "" 21 | ChooseSession.new( 22 | [ 23 | ["I have installed Rime. Let's go next.", -> {}], 24 | [ 25 | "I'll quit first.After installed Rime by myself then run this program again.", 26 | -> { exit 0 } 27 | ] 28 | ] 29 | ).call 30 | sleep 1 31 | return :next 32 | end 33 | end 34 | 35 | class BackupRimeConfigJob < Job 36 | def call 37 | puts intro 38 | system( 39 | "move #{Store.config_path} #{Store.config_path}.#{Time.now.to_i}.old" 40 | ) 41 | sleep 1 42 | return :next 43 | end 44 | end 45 | 46 | class CloneConfigJob < Job 47 | def call 48 | puts intro 49 | system( 50 | "git clone --depth=1 #{Config::RIME_CONFIG_REPO} #{Store.config_path}" 51 | ) 52 | sleep 1 53 | return :next 54 | end 55 | end 56 | 57 | class CopyCustomConfigJob < Job 58 | def call 59 | puts intro 60 | system("copy .\\custom\\*.yaml #{Store.config_path}") 61 | sleep 1 62 | return :next 63 | end 64 | end 65 | 66 | class FinishedJob < Job 67 | def call 68 | puts "" 69 | puts "Tips: When finished all jobs. You need to do follow:".yellow 70 | puts "1) Restart system." 71 | puts "2) open Rime input method setting pane and click " + 72 | "DEPLOY".yellow + " button." 73 | puts "Enjoy~" 74 | puts "more info:".yellow 75 | puts "Config path: #{Store.config_path}" 76 | return :next 77 | end 78 | end 79 | self.before_jobs = [CheckInstallRimeJob] 80 | self.jobs = [BackupRimeConfigJob, CloneConfigJob, CopyCustomConfigJob] 81 | self.after_jobs = [FinishedJob] 82 | self.upgrade_jobs = [ 83 | Upgrade::UpgradeRimeAutoDeployJob, 84 | Upgrade::UpgradeRimeConfigJob 85 | ] 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /share/upgrade.rb: -------------------------------------------------------------------------------- 1 | module RimeDeploy 2 | module Upgrade 3 | class UpgradeRimeAutoDeployJob < Job 4 | def call 5 | puts "Upgrade `Rime Auto Deploy` script ..." 6 | project_path = File.expand_path(Dir.pwd) 7 | if File.directory?(File.join(project_path, ".git")) 8 | puts "Git repository found." 9 | system("cd #{project_path} && git remote get-url origin") 10 | puts "Try upgrading..." 11 | system("cd #{project_path} && git pull") 12 | else 13 | puts "You can download the latest version from here." 14 | puts "https://github.com/Mark24Code/rime-auto-deploy" 15 | end 16 | return :next 17 | end 18 | end 19 | 20 | class UpgradeRimeConfigJob < Job 21 | def call 22 | puts "Upgrade Rime Config" 23 | config_abs_path = File.expand_path(Store.config_path) 24 | if File.directory?(File.join(config_abs_path, ".git")) 25 | puts "Git repository found." 26 | system("cd #{config_abs_path} && git remote get-url origin") 27 | puts "Try upgrading..." 28 | system("cd #{config_abs_path} && git pull") 29 | else 30 | puts "Error:".yellow 31 | puts "Rime Config seems broken. You may delete the directory.".red 32 | puts "You can:" 33 | puts "Rerun the deploy script from start choose [Auto Mode] to reinstall." 34 | puts "" 35 | puts "After 5 seconds, will go to [Upgrade Mode].".yellow 36 | sleep 5 37 | throw :halt, :run_jobs_upgrade 38 | end 39 | 40 | return :next 41 | end 42 | end 43 | end 44 | end 45 | --------------------------------------------------------------------------------