How to use a variant dictionary (`a{sv}`) in dbus-send

前端 未结 3 1883
梦如初夏
梦如初夏 2021-02-05 18:59

I have some trouble with dbus-send when using a{sv}

Calling a method with in_signature=\'a{ss}\' seems to work using the followin

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 19:39

    Not possible with dbus-send

    As mentioned, dbus-send does not support all Dbus types. From dbus-send man page:

    Also, dbus-send does not permit empty containers or nested containers (e.g. arrays of variants).


    But possible gdbus

    Buried in https://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gio/gdbus.html we see this:

    gdbus call --session \
               --dest org.freedesktop.Notifications \
               --object-path /org/freedesktop/Notifications \
               --method org.freedesktop.Notifications.Notify \
               my_app_name \
               42 \
               gtk-dialog-info \
               "The Summary" \
               "Here's the body of the notification" \
               [] \
               {} \
               5000
    

    Bonus: this method returns the id, so you can close or replace the notification.

提交回复
热议问题