Skip to content

Commit

Permalink
feat(event): add command set_color_scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan authored and WhiredPlanck committed May 11, 2024
1 parent 46cd745 commit 8d676c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/src/main/assets/rime/trime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ preset_keys:
liquid_keyboard_exit: {label: 返回, send: function, command: liquid_keyboard, option: "-1"} #退出liquidkeyboard
liquid_keyboard_emoji: { label: 🙂, send: function, command: liquid_keyboard, option: "emoji" }
liquid_keyboard_clipboard: { label: 剪贴, send: function, command: liquid_keyboard, option: "剪贴" }
set_color_ink: { label: 切换到ink配色, send: function, command: set_color_scheme, option: "ink" }
# trime設定
IME_switch: { label: 🌐, send: LANGUAGE_SWITCH } #彈出對話框選擇輸入法
IME_last: { label: 上一輸入法, send: LANGUAGE_SWITCH, select: .last } #直接切換到上一輸入法
Expand Down
21 changes: 10 additions & 11 deletions app/src/main/java/com/osfans/trime/ime/text/TextInputManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.osfans.trime.daemon.RimeSession
import com.osfans.trime.daemon.launchOnReady
import com.osfans.trime.data.AppPrefs
import com.osfans.trime.data.schema.SchemaManager
import com.osfans.trime.data.theme.ColorManager
import com.osfans.trime.data.theme.EventManager
import com.osfans.trime.data.theme.ThemeManager
import com.osfans.trime.ime.core.InputView
Expand Down Expand Up @@ -351,17 +352,15 @@ class TextInputManager(
)
}

if (event.command == "liquid_keyboard") {
trime.selectLiquidKeyboard(arg)
} else if (event.command == "paste_by_char") {
trime.pasteByChar()
} else {
val textFromCommand =
ShortcutUtils
.call(trime, event.command, arg)
if (textFromCommand != null) {
trime.commitCharSequence(textFromCommand)
trime.updateComposing()
when (event.command) {
"liquid_keyboard" -> trime.selectLiquidKeyboard(arg)
"paste_by_char" -> trime.pasteByChar()
"set_color_scheme" -> ColorManager.setColorScheme(arg)
else -> {
ShortcutUtils.call(trime, event.command, arg)?.let {
trime.commitCharSequence(it)
trime.updateComposing()
}
}
}
}
Expand Down

0 comments on commit 8d676c8

Please sign in to comment.