A tiny fcitx5 addon that lets other programs insert a UTF-8 string into the currently focused text field over D-Bus.
fcitx5 has no external API for that: its Controller1 D-Bus interface can
switch input methods, but it cannot type text. Programs that want to insert
text are left with synthesizing key presses (uinput, wtype, ydotool, …),
which is slow, depends on the active keyboard layout and cannot produce
characters the layout does not have. This addon commits the string straight
into the focused input context — the same path fcitx5 uses when you pick a
pinyin candidate — so any text arrives in one piece, whatever the layout.
It is used by skvirt, an on-screen keyboard for KDE Plasma / KWin, to type dictated text (voice input); skvirt falls back to key taps when the addon is not installed.
The object lives on fcitx5's own session-bus connection, so it is reached through fcitx5's well-known name:
| Service | org.fcitx.Fcitx5 |
| Object path | /commit |
| Interface | io.github.vendetta1871.Commit1 |
| Method | CommitString(s text) → (b committed) |
CommitString looks at the most recent input context:
- if there is none, or it does not have focus, nothing is committed and the
method returns
false; - otherwise
textis committed (when it is non-empty) and the method returnstrue.
So an empty string is a harmless probe for "is there a focused text field to type into?".
# Type "Hello, мир ✓" into whatever text field has focus right now
busctl --user call org.fcitx.Fcitx5 /commit io.github.vendetta1871.Commit1 CommitString s "Hello, мир ✓"
# Probe: prints "b true" if a text field has focus, "b false" otherwise
busctl --user call org.fcitx.Fcitx5 /commit io.github.vendetta1871.Commit1 CommitString s ""
# Is the addon loaded at all?
busctl --user introspect org.fcitx.Fcitx5 /commitThe same call with gdbus:
gdbus call --session --dest org.fcitx.Fcitx5 --object-path /commit \
--method io.github.vendetta1871.Commit1.CommitString "text"paru -S fcitx5-commit-git # or any other AUR helperRequires fcitx5 ≥ 5.1 (with its development headers — part of the fcitx5
package on Arch), CMake and a C++20 compiler.
git clone https://github.com/Vendetta1871/fcitx5-commit.git
cd fcitx5-commit
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
cmake --build build
sudo cmake --install buildWith CMAKE_INSTALL_PREFIX equal to fcitx5's own prefix the files go where
fcitx5 looks for addons:
/usr/lib/fcitx5/libcommit.so/usr/share/fcitx5/addon/commit.conf
fcitx5 only discovers addons at startup, so restart fcitx5 after installing.
Usually fcitx5 -r -d does it. On KDE Plasma Wayland KWin starts fcitx5
itself (as the virtual keyboard), so instead re-select fcitx5 in System
Settings → Keyboard → Virtual Keyboard, or log out and back in.
The addon is enabled by default and loads together with fcitx5 (it is not loaded on demand); it shows up in fcitx5's addon list as "Commit String over D-Bus".
To see what it does, run fcitx5 with --verbose=commit=5.
Any process that can talk to your session bus can call CommitString and
insert text into whichever field has focus. This is the same trust boundary as
fcitx5's own org.fcitx.Fcitx.Controller1 D-Bus API (which can, for example,
switch your input method) and as the session bus in general: programs running
as you on your session are trusted. The addon only ever commits text; it
cannot read what you type, and it never sees key events.