feat: add menu bar ascii_mode display#1130
Open
Cosss7 wants to merge 1 commit into
Open
Conversation
- 切换 app 时 menu bar 状态跟随当前 session 的 ascii_mode 更新 - 增加配置 squirrel.yaml 中 menubar_ascii_mode 默认 false
cd08941 to
1a37507
Compare
lotem
reviewed
May 20, 2026
| func showStatusMessage(msgTextLong: String?, msgTextShort: String?) { | ||
| if !(msgTextLong ?? "").isEmpty || !(msgTextShort ?? "").isEmpty { | ||
| panel?.updateStatus(long: msgTextLong ?? "", short: msgTextShort ?? "") | ||
| statusBarManager.updateStatus(text: msgTextShort ?? "") |
|
|
||
| func updateMenuBarStatus() { | ||
| guard session != 0 else { return } | ||
| let isAsciiMode = rimeAPI.get_option(session, "ascii_mode") |
Member
There was a problem hiding this comment.
最好先檢查狀態圖標是否啓用,未啓用則不需要獲取當前狀態、簡寫等信息。
Author
他的更完善,我研究一下~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决一个长久以来的用户体验问题: #118
本 PR 由 AI 编写,人工审核,如果有任何问题请 comment on PR ,我会及时修改,共同建设 RIME
功能摘要
在 macOS 菜单栏中显示当前输入法的中英文状态(如"中"/"A"),方便用户随时知晓当前输入模式。
实现细节
StatusBarManager.swift:管理NSStatusItem的生命周期和文本更新SquirrelApplicationDelegate:StatusBarManager实例menubar_ascii_mode配置(默认true)showStatusMessage中同步更新菜单栏状态teardown()清理菜单栏图标SquirrelInputController:activateServer()中查询当前ascii_mode并更新菜单栏显示updateMenuBarStatus()方法,通过 Rime API 获取状态标签project.pbxproj:添加StatusBarManager.swift到编译目标配置项
在
squirrel.yaml中新增(向后兼容,默认开启):测试计划
menubar_ascii_mode: false,菜单栏图标不显示