Skip to content

feat(dbus):add getAllHotkeys dbus interface #1394

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

Conversation

liehen
Copy link
Contributor

@liehen liehen commented Aug 6, 2025

The getAllHotkeys DBus interface returns information about global hotkeys and all hotkeys in the current input method group
The return value parameters include: category, name, unique name, description, and hotkey list

@liehen liehen force-pushed the add-getAllHotkeys-dbus-method branch from 80e0230 to 8fc4d86 Compare August 7, 2025 01:16
@wengxt
Copy link
Member

wengxt commented Aug 7, 2025

I'd rather this is implemented with multiple existing dbus call and filter on dbus client side.

@wengxt
Copy link
Member

wengxt commented Aug 7, 2025

If you insist on having a dbus call, you can implement in a separate (dbus) addon, instead of being an addition to this dbus addon.

Some example:
https://github.com/fcitx/fcitx5-rime/blob/master/src/rimeservice.cpp

The reason is I find this request is too specific and is tightly couple with whatever use case you have. It's useful, but not generally useful. If you find you have some other filtering request, you have to introduce something new. Instead, filter on cilent side is very flexible and you'll have much more freedom. I believe performance won't be a concern here, if it is indeed too slow, you can still do it with your own addon.

@liehen
Copy link
Contributor Author

liehen commented Aug 11, 2025

Thank you for the suggestions. Below are the reasons for submitting this pull request:

Background: Using the UKUI-style input method configuration tool, there is currently no shortcut conflict detection. Implementing this functionality is required.

Current Problem: Although Fcitx5's DBus interface can retrieve the global configuration and individual input method configurations, the following issues exist:

After obtaining the configuration information, the contained shortcut keys need to be extracted.

Retrieving the input method configurations requires multiple calls to the GetConfig method.

To get the global shortcut configuration:
GetConfig("fcitx://config/global")

To get input method shortcut configurations: If there are 5 input methods in the current list, at least 7 interface calls are needed:
CurrentInputMethodGroup()
FullInputMethodGroupInfo("groupName")
GetConfig("fcitx://config/inputmethod/...") * 5 (once for each input method)

Therefore, a new getAllHotkeys method has been added to retrieve all shortcut information at once, enabling conflict detection and warnings through this data.

And I'll take a look at the example you mentioned above.

@wengxt
Copy link
Member

wengxt commented Aug 11, 2025

Hint: you can always use Chinese.

The conflict detection, while useful, is a tricky thing to do.

Whether a key can be triggered depending on the current context/state. Blindly do such extraction would only give you false result.

For example, table addon and table's input method config contains both hotkey configuration.
fullwidth addon contains key can be triggered from certain input method, without code from every addon being involved, there's no way to do this correctly. The thing you This is not a feasible approach to solve the problem.

To really solve this in a correct way would require define some new API to manage the hotkey and their corresponding scope. like a new class maybe called HotkeyManager or sth, and let every addon to subscribe a scope handle to allow detect conflicts for individual key.

@liehen
Copy link
Contributor Author

liehen commented Aug 11, 2025

抱歉刚看到回复,我会按您的建议再重新考虑下对应的场景~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants