DBus Interface

From Fcitx
Jump to navigation Jump to search

This page is about certain things that you can do with the dbus interface of Fcitx 5.

This page will use qdbus as an command example for its simplicity. You may also use dbus-send, or busctl, but the command will be slighty different. Certain functionality is also provided by fcitx5-remote. In that case fcitx5-remote command will also be listed.

qdbus [service name] [object path] [interface].[member] [arguments]
busctl --user call [service name] [object path] [interface] [member] [arguments]
dbus-send --session --print-reply --dest=[service name] [object path] [interface].[member] [arguments]

For example:

Call org.fcitx.Fcitx.Controller1.ReloadConfig with argument "pinyin" with these 3 commands would be:

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.ReloadAddonConfig pinyin
busctl --user call org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1 ReloadAddonConfig s pinyin
dbus-send --session --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.ReloadAddonConfig string:pinyin

Get current input method name

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.CurrentInputMethod
fcitx5-remote -n

Get current input method group name

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.CurrentInputMethodGroup
fcitx5-remote -q

Toggle active/inactive state

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.Toggle
fcitx5-remote -t

Set state to active

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.Activate
fcitx5-remote -o

Set state to inactive

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.Deactivate
fcitx5-remote -c

Get current state

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.State
fcitx5-remote

Ask fcitx to quit

# Simply "killall fcitx5" is also fine.
qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.Exit
fcitx5-remote -e

Reload configuration from disk

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.ReloadAddonConfig [addon name]
qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.ReloadConfig # reload global config

Open a new X11 connection from Fcitx

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.OpenX11Connection [x11 display] 

Open a new wayland connection from Fcitx

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.OpenWaylandConnection [wayland display]

Set current input method

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.SetCurrentIM [input method name]
fcitx5-remote -s [input method name]

See all the connected client to fcitx

# Same information is available in fcitx5-diagnose
qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.DebugInfo

Set current group

qdbus org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.SwitchInputMethodGroup [group name]
fcitx5-remote -g [group name]