DBus

From Inkscape Wiki
Revision as of 11:50, 13 November 2021 by Tavmjong (talk | contribs) (Created page with " Inkscape has supported a DBus interface for some time.... but information on how to use it is lacking. It is also not clear how to use Gio::Actions which are suppose to work...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Inkscape has supported a DBus interface for some time.... but information on how to use it is lacking. It is also not clear how to use Gio::Actions which are suppose to work with DBus. This page is an investigation into using DBus with Inkscape.

It would be very useful if anyone who has experience with using the DBus interface add information here!

Simple Use

Verification that DBus actually still works (on Fedora):

  • Compile with DBUS (cmake -DWITH_DBUS=ON path_to_source).
  • Start Inkscape.
  • Open an Emacs window.
  • Type:

    (message "%s on board." (cond   ((dbus-ping :session "org.inkscape" 100) "Inkscape")   (t "No")))

    Put the cursor at the very end of the function (just after ')))') and type Ctrl-X Ctrl-E.
  • The Emacs 'Message" buffer should show "Inkscape on board" if you have successfully connected to the running Inkscape app.

Open a New Inkscape Window:

  • Type:

    (dbus-call-method               :session "org.inkscape" "/org/inkscape/application"               "org.inkscape.application" "desktop_new")

    Put the cursor at the very end of the function and type Ctrl-X Ctrl-E.
  • The Emacs "Message" buffer should show "/org/inkscape/desktop_1" and a new window should have opened.

Add a rectangle:

  • Type:

    (dbus-call-method               :session "org.inkscape" "/org/inkscape/desktop_1"               "org.inkscape.document" "rectangle" :int32 100 :int32  100 :int32  100 :int32  100)

    Put the cursor at the very end of the function and type Ctrl-X Ctrl-E.
  • A rectangle should appear in the new Inkscape drawing.

Notes

Command line arguments:

  • --dbus-listen
  • --dbus-name=BUS-NAME
  • --display=DISPLAY

How to use these? At least the --dbus-name does not seem to work (bus name is always "org.inkscape").

Useful links: