diff --git a/src/rimeengine.cpp b/src/rimeengine.cpp index 94cd656..25b9f4d 100644 --- a/src/rimeengine.cpp +++ b/src/rimeengine.cpp @@ -403,6 +403,9 @@ void RimeEngine::updateConfig() { updateSchemaMenu(); refreshSessionPoolPolicy(); + deployAction_.setHotkey(config_.deploy.value()); + syncAction_.setHotkey(config_.synchronize.value()); + if (constructed_) { refreshStatusArea(0); } @@ -494,6 +497,15 @@ void RimeEngine::keyEvent(const InputMethodEntry &entry, KeyEvent &event) { RIME_DEBUG() << "Rime receive key: " << event.rawKey() << " " << event.isRelease(); auto *inputContext = event.inputContext(); + if (!event.isRelease()) { + if (event.key().checkKeyList(*config_.deploy)) { + deploy(); + return event.filterAndAccept(); + } else if (event.key().checkKeyList(*config_.synchronize)) { + sync(); + return event.filterAndAccept(); + } + } auto *state = this->state(inputContext); currentKeyEventState_ = state; state->keyEvent(event); diff --git a/src/rimeengine.h b/src/rimeengine.h index d96470d..3ecc012 100644 --- a/src/rimeengine.h +++ b/src/rimeengine.h @@ -100,7 +100,12 @@ FCITX_CONFIGURATION( Option> modules{this, "Modules", _("Modules"), std::vector()}; #endif -); + fcitx::Option deploy{ + this, "Deploy", _("Deploy"), + isApple() ? fcitx::KeyList{fcitx::Key("Control+Alt+grave")} + : fcitx::KeyList{}}; + fcitx::Option synchronize{ + this, "Synchronize", _("Synchronize"), {}};); class RimeEngine final : public InputMethodEngineV2 { public: