Skip to content

feat(tsf): hide IME mode icon #1515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions WeaselSetup/WeaselSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ static int Run(LPTSTR lpCmdLine) {
return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel",
L"ToggleImeOnOpenClose", L"no", REG_SZ);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/toggleime, /toggleascii, /hidemodeicon, /showmodeicon

這些是否方便寫在配置文件 weasel.yaml 裏?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我也是看之前有这样的先例,想着小众需求就也这样做吧,之前已经跟 @fxliang 交流过了。怎么说,要改么?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不知道這個地方讀寫配置方不方便。我擔心註冊表開關越加越多,不統一了。

if (!wcscmp(L"/hidemodeicon", lpCmdLine)) {
return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel",
L"HideImeModeIcon", L"yes", REG_SZ);
}
if (!wcscmp(L"/showmodeicon", lpCmdLine)) {
return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel",
L"HideImeModeIcon", L"no", REG_SZ);
}

if (!wcscmp(L"/testing", lpCmdLine)) {
return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel",
L"UpdateChannel", L"testing", REG_SZ);
Expand Down
8 changes: 6 additions & 2 deletions WeaselTSF/LanguageBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,12 @@ BOOL WeaselTSF::_InitLanguageBar() {
if (_pThreadMgr->QueryInterface(&pLangBarItemMgr) != S_OK)
return FALSE;

if ((_pLangBarButton = new CLangBarItemButton(this, GUID_LBI_INPUTMODE,
_cand->style())) == NULL)
std::wstring hideIcon{};
RegGetStringValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel",
L"HideImeModeIcon", hideIcon);
GUID langBarGuid = (hideIcon == L"yes") ? GUID_NULL : GUID_LBI_INPUTMODE;
if ((_pLangBarButton =
new CLangBarItemButton(this, langBarGuid, _cand->style())) == NULL)
return FALSE;

if (pLangBarItemMgr->AddItem(_pLangBarButton) != S_OK) {
Expand Down