[RFC] Sane CLI for dbus

Thiago Macieira thiago at kde.org
Thu Apr 1 06:50:06 PDT 2010


Em Quinta-feira 1. Abril 2010, às 14.20.32, Luis Javier Merino escreveu:
> Hi,
> 
> Attached is a dcop-style CLI for dbus, meant to call dbus from the
> shell (think d-feet for the shell), so for instance, to change
> Konsole's window title you'd do:

Hi Luis

Can you tell me what you're trying to improve with your tool that qdbus 
doesn't do?

> $ dbus-sane.pl
> org.freedesktop.DBus
> org.freedesktop.PowerManagement
> org.freedesktop.Notifications
> [...snip...]
> org.kde.konsole
> [...snip...]

$ qdbus        
:1.0
:1.103
 com.Skype.API
:1.105
 org.kde.internal.KSettingsWidget-kcm_kopete_statusconfig
 org.kde.kopete
[...snip...]
:1.23
 org.kde.konsole
[...snip...]

> $ dbus-sane.pl org.kde.konsole
> I org.freedesktop.DBus.Introspectable
>  M Introspect (out s xml_data)
> O MainWindow_1

$ qdbus org.kde.konsole
/
[...snip...]
/konsole
/konsole/MainWindow_1
/konsole/MainWindow_1/actions
[...snip...]

> $ dbus-sane.pl org.kde.konsole MainWindow_1
>  [...snip...]
> I org.kde.konsole.KMainWindow
>  M setCaption (in s caption)
>  M setCaption (in s caption, in b modified)
>  M setPlainCaption (in s caption)
>  M appHelpActivated ()
>  M setSettingsDirty ()
>  P hasMenuBar (b, read)
>  P autoSaveSettings (b, read)
>  P autoSaveGroup (s, read)
>  P initialGeometrySet (b, read)
> [...snip...]
> I com.trolltech.Qt.QWidget
> [...snip...]
>  P windowTitle (s, readwrite)
> [...snip...]
> I org.freedesktop.DBus.Properties
>  M Get (in s interface_name, in s property_name, out v value)
>  M Set (in s interface_name, in s property_name, in v value)
>  M GetAll (in s interface_name, out a{sv} values)
> I org.freedesktop.DBus.Introspectable
>  M Introspect (out s xml_data)
> O actions

$ qdbus org.kde.konsole /konsole/MainWindow_1
property read QString org.kde.konsole.KXmlGuiWindow.autoSaveGroup
property read bool org.kde.konsole.KXmlGuiWindow.autoSaveSettings
property read bool org.kde.konsole.KXmlGuiWindow.hasMenuBar
property read bool org.kde.konsole.KXmlGuiWindow.initialGeometrySet
[...snip...]
property readwrite double com.trolltech.Qt.QWidget.windowOpacity
property readwrite QString com.trolltech.Qt.QWidget.windowTitle
[...snip...]
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString 
interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString 
interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, 
QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()

> $ dbus-sane.pl org.kde.konsole MainWindow_1 setPlainCaption foobar
> 
> $ dbus-sane.pl org.kde.konsole MainWindow_1 Get
> org.freedesktop.DBus.Properties WindowTitle
> 'foobar'

$ qdbus org.kde.konsole /konsole/MainWindow_1 setPlainCaption foobar

$ qdbus org.kde.konsole /konsole/MainWindow_1 Get 
org.freedesktop.DBus.Properties WindowTitle
Error: org.freedesktop.DBus.Error.UnknownInterface
Interface org.freedesktop.DBus.Properties was not found in object 
/konsole/MainWindow_1

$ qdbus org.kde.konsole /konsole/MainWindow_1 Get com.trolltech.Qt.QWidget 
windowTitle
foobar

$ qdbus org.kde.konsole /konsole/MainWindow_1 
com.trolltech.Qt.QWidget.windowTitle    
foobar

$ qdbus org.kde.konsole /konsole/MainWindow_1 
com.trolltech.Qt.QWidget.windowTitle Konsole



-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100401/dec7dd02/attachment.pgp>


More information about the dbus mailing list