Skip to content

Commit

Permalink
add new dbus method to get current input method info
Browse files Browse the repository at this point in the history
  • Loading branch information
hantengc committed Feb 10, 2025
1 parent 1cd5f66 commit ef54471
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/modules/dbus/dbusmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,27 @@ class Controller1 : public ObjectVTable<Controller1> {

void setLogRule(const std::string &rule) { Log::setLogRule(rule); }

std::vector<
dbus::DBusStruct<std::string, std::string, std::string, std::string,
std::string, std::string, std::string, bool>>
currentInputMethodInfo() {
std::vector<
dbus::DBusStruct<std::string, std::string, std::string, std::string,
std::string, std::string, std::string, bool>>
result;
std::string currentIM = instance_->currentInputMethod();
const auto *entry = instance_->inputMethodManager().entry(currentIM);
if (entry == nullptr) {
return {};
}

result.emplace_back(entry->uniqueName(), entry->name(),
entry->nativeName(), entry->icon(), entry->label(),
entry->languageCode(), entry->addon(),
entry->isConfigurable());
return result;
}

private:
DBusModule *module_;
Instance *instance_;
Expand Down Expand Up @@ -750,6 +771,8 @@ class Controller1 : public ObjectVTable<Controller1> {
FCITX_OBJECT_VTABLE_METHOD(save, "Save", "", "");
FCITX_OBJECT_VTABLE_METHOD(setLogRule, "SetLogRule", "s", "");
FCITX_OBJECT_VTABLE_METHOD(canRestart, "CanRestart", "", "b");
FCITX_OBJECT_VTABLE_METHOD(currentInputMethodInfo, "CurrentInputMethodInfo",
"", "a(sssssssb)");
};

DBusModule::DBusModule(Instance *instance)
Expand Down

0 comments on commit ef54471

Please sign in to comment.