Does Kwin script's callDBus support a{sv} argument type?

Phương Lê Hoàng lehoangphuongbg at gmail.com
Wed Mar 10 11:43:44 GMT 2021


Hi all,

I'm writing a Kwin script to automatically set an unread count badge to an
app's launcher icon by parsing its title.

I'm stuck at the part where I need to call an DBus API, but always get
"Received D-Bus message is error". I appreciate any help to show me where I
got it wrong, or callDBus just doesn't support passing a{sv} argument yet.

This is the method that I need to call:
https://wiki.ubuntu.com/Unity/LauncherAPI#Low_level_DBus_API:_com.canonical.Unity.LauncherEntry

I can use gdbus and it successfully update the launcher's icon badge:

gdbus emit --session --object-path /com/canonical/unity/launcherentry/1
--signal com.canonical.Unity.LauncherEntry.Update
"application://chrome-ebcgcbpjedmohalnmiodnfidggpfcehe-Default.desktop"
"{'count-visible': <true>, 'count': <2>}"

But when I attempt to use callDBus in my script, it fails:

callDBus(
  "com.canonical.Unity", // Service
  "/com/canonical/unity/launcherentry/1", // Path
  "com.canonical.Unity.LauncherEntry", // Interface
  "Update", // Method
  "application://chrome-ebcgcbpjedmohalnmiodnfidggpfcehe-Default.desktop",
  { "count-visible": true, count: 1 }
);

I tried to read the source code of callDBus and failed to understand
whether it supports a{sv} or not, since I'm not familiar with Qt and C++.
https://invent.kde.org/plasma/kwin/-/blob/master/src/scripting/scripting.cpp#L253

Thanks in advance for any help.
Regards,
Le Phuong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20210310/da8ed905/attachment.htm>


More information about the kde-devel mailing list