diff --git a/.gitignore b/.gitignore index 13b7c2b..6be27b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -Rime/build -Rime/*.userdb* -Rime/installation.yaml -Rime/user.yaml +Rime +*.exe +*.dll diff --git a/README.md b/README.md index e981247..16be8e4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,16 @@ [GPL-3.0](LICENSE) +## 使用的开源项目 + +- [librime](https://github.com/rime/librime) +- [librime-ahk](https://github.com/amorphobia/librime-ahk) +- [GetCaretPos](https://github.com/Descolada/AHK-v2-libraries) +- [🌟️星空键道](https://github.com/amorphobia/rime-jiandao) +- [朙月拼音](https://github.com/rime/rime-luna-pinyin) + +以及一些代码片段,在注释中注明了来源链接 + ## ⚠️正在施工⚠️ 目前仅实现了一个原型,上下文界面使用 [ToolTip](https://www.autohotkey.com/docs/v2/lib/ToolTip.htm) 简单显示,但已经可以用来输入了,此 README 文件就是使用玉兔毫部署的[星空键道](https://github.com/amorphobia/rime-jiandao)方案编写。可以在 Actions 里找到自动打包的文件,解压后运行 `Rabbit.exe` 即可。 @@ -18,3 +28,4 @@ - 注册热键的问题,例如,上档键输入的字符似乎需要额外注册;热键过多,注册会比较耗时等问题(已取消 Win 键的相关注册,应该有所缓解) - 并非使用系统的输入法接口,而是用热键的方式获取按键,可能导致一些问题,如,需要保留一个英文输入语言;退出玉兔毫时,可能无法恢复先前的输入法语言等 - 管理员权限打开的窗口应该不起作用 +- Windows 远程桌面连接中,不应拦截切换 ascii mode 的热键,而是交给远程桌面控制 diff --git a/Rabbit.ahk b/Rabbit.ahk index 8c4ebb7..bb84d36 100644 --- a/Rabbit.ahk +++ b/Rabbit.ahk @@ -162,7 +162,39 @@ ProcessKey(key, mask, this_hotkey) { if not code return + static STATUS_TOOLTIP := 2 + local status := rime.get_status(session_id) + local old_ascii_mode := status.is_ascii_mode + local old_full_shape := status.is_full_shape + local old_ascii_punct := status.is_ascii_punct + rime.free_status(status) + processed := rime.process_key(session_id, code, mask) + + status := rime.get_status(session_id) + local new_ascii_mode := status.is_ascii_mode + local new_full_shape := status.is_full_shape + local new_ascii_punct := status.is_ascii_punct + rime.free_status(status) + + local status_text := "" + local status_changed := false + if old_ascii_mode != new_ascii_mode { + status_changed := true + status_text := new_ascii_mode ? "En" : "中" + } else if old_full_shape != new_full_shape { + status_changed := true + status_text := new_full_shape ? "全" : "半" + } else if old_ascii_punct != new_ascii_punct { + status_changed := true + status_text := new_ascii_punct ? ",." : ",。" + } + + if status_changed { + ToolTip(status_text, , , STATUS_TOOLTIP) + SetTimer(() => ToolTip(, , , STATUS_TOOLTIP), -2000) + } + if commit := rime.get_commit(session_id) { SendText(commit.text) ToolTip()