請用以下的 patch 改看看:
--- a/python/input_methods/chewing/chewing_ime.py
+++ b/python/input_methods/chewing/chewing_ime.py
@@ -28,6 +28,11 @@ from ctypes import windll # for ShellExecuteW()
from .chewing_config import chewingConfig
+import ctypes
+def CAPSLOCK_STATE():
+ hllDll = ctypes.WinDLL("User32.dll")
+ caps = hllDll.GetKeyState(VK_CAPITAL)
+ return (caps & 0x0001)
# 按鍵內碼和名稱的對應
keyNames = {
@@ -351,6 +356,11 @@ class ChewingTextService(TextService):
return False
# -------------- 以下皆為中文模式 --------------
+ # 中文模式下按下 Capslock,須更新語言列
+ if cfg.enableCapsLock and keyEvent.isKeyDown(VK_CAPITAL):
+ self.updateSwitchLangIcon = True
+ self.updateLangButtons()
+
# 中文模式下開啟 Capslock,須切換成英文
if cfg.enableCapsLock and keyEvent.isKeyToggled(VK_CAPITAL):
# 如果此按鍵是英文字母,中文模式下要從大寫轉小寫,需要輸入法處理
@@ -392,6 +402,11 @@ class ChewingTextService(TextService):
else:
chewingContext.set_easySymbolInput(0)
+ # 中文模式下按下 Capslock,須更新語言列
+ if cfg.enableCapsLock and keyEvent.isKeyDown(VK_CAPITAL):
+ self.updateSwitchLangIcon = True
+ self.updateLangButtons()
+
# 若目前輸入的按鍵是可見字元 (字母、數字、標點、空白...等)
if keyEvent.isPrintableChar():
keyHandled = True
@@ -769,6 +784,8 @@ class ChewingTextService(TextService):
icon_name = "simC.ico"
else:
icon_name = "traC.ico"
+ if chewingConfig.enableCapsLock and CAPSLOCK_STATE():
+ icon_name = "engC.ico"
else:
icon_name = "eng.ico"
icon_path = os.path.join(self.icon_dir, icon_name)