[Python] Failed to list all input-engines available to linux ibus using python

Discussão em 'Python' iniciado por Stack, Setembro 6, 2025.

  1. Stack

    Stack Membro Participativo

    My system is Kali 2022. I am new to linux and trying to interact with IBus using a python script. I have done the following things:

    1. Installed ibus using sudo apt install ibus
    2. Started ibus-daemon using ibus-setup which prompt me start ibus-daemon through gui.

    And then I wrote a python script to list all the input-engines available to ibus system. When I run the script I get interface not found in org.freedesktop.IBus.

    Then to identify the problem, I have installed qdbus package and run qdbus in terminal as it will let users to list available services and objects, inspect interfaces. I get the following result:

    org.mozilla.firefox.L2hvbWUvc2hpbWFudHRhLy5tb3ppbGxhL2ZpcmVmb3gvaXlmZWl3eW4uZGVmYXVsdC1yZWxlYXNlLTI_
    :1.68
    org.freedesktop.IBus
    :1.69
    :1.70
    org.freedesktop.portal.IBus
    :1.71
    org.freedesktop.IBus.Panel.Extension.Gtk3
    :1.72
    :1.73
    :1.74
    :1.81
    org.xfce.mousepad
    :1.89
    org.freedesktop.DBus


    Above I can see an entry called org.freedesktop.IBus present. But when I attempt to get the objects exposed by this service, I get the following:

    $ qdbus org.freedesktop.IBus

    /
    ---->Got empty / .Supposed to expose /org/freedesktop/IBus path I guess


    Also systemctl command to check ibus-daemon service's status, returns no such service running even though I've started ibus-daemon.

    └─$ systemctl status ibus-daemon
    Unit ibus-daemon.service could not be found.


    Following is the Python script:

    import asyncio
    from dbus_next.aio import MessageBus
    from dbus_next import BusType

    async def main():
    bus = await MessageBus(bus_type=BusType.SESSION).connect()
    introspection = await bus.introspect('org.freedesktop.IBus', '/org/freedesktop/IBus')
    ibus = bus.get_proxy_object('org.freedesktop.IBus', '/org/freedesktop/IBus', introspection)
    ibus_iface = ibus.get_interface('org.freedesktop.IBus')
    print("Successfully connected to IBus D-Bus service.")
    # List engines
    engines = await ibus_iface.call_list_engines()
    print("Available engines:", engines)

    await bus.disconnect()

    asyncio.run(main())

    Continue reading...

Compartilhe esta Página