I know Inkscape has both a GUI mode and a command-line interface. But I am wondering if it is possble to have an open (GUI) instance of Inkscape, and interact with it via command-line?
For example, could I be working on a document, and set up a command-line script to auto-save every 5 minutes? (Just an example, not my intended use case).
The "new" gdbus implementation provided by gtk/glib that (in theory) allows you to execute so-called "actions" (see --action-list CLI parameter) However this is untested as of yet (AFAIK) and might not work as expected, so is also highly experimental.
(and if auto-save was your use case, that's already built-in 😁)
Very interesting! Thankyou for the information. I can fall back on compiling for myself if I have to, but I would rather not at the moment. In regards to the "new" gdbus, would it be possible to access the verb-list as well? I assume probably not, just thought I would check.
Similarly, I don't suppose it is possible to write an extension that it is registered as an action rather than (or in addition to) a verb?
You can currently use verbs as actions (the long term goal is to replace verbs piece by piece with actions).
What I did not explain clearly before: It's currently probably not possible to control an already running instance of Inkscape via gdbus, but only a new one. We currently set `Gio::APPLICATION_NON_UNIQUE` which results in inkscape running parallel processes. This should change at some point, but currently causes some regressions.
Hello,
I know Inkscape has both a GUI mode and a command-line interface. But I am wondering if it is possble to have an open (GUI) instance of Inkscape, and interact with it via command-line?
For example, could I be working on a document, and set up a command-line script to auto-save every 5 minutes? (Just an example, not my intended use case).
Thanks for any help!
In theory: yes.
In practice: Only if you're prepared to put in some effort.
To expand on that: Inkscape can be controlled via DBUS and there are actually two variants
https://wiki.inkscape.org/wiki/index.php/Lib2geom_py2geom (outdated) and
https://gitlab.com/inkscape/lib2geom/-/tree/master/src/py2geom (only code).
Unfortunately it's not included in most of our current builds, so you might have to compile from source yourself.
However this is untested as of yet (AFAIK) and might not work as expected, so is also highly experimental.
(and if auto-save was your use case, that's already built-in 😁)
Very interesting! Thankyou for the information. I can fall back on compiling for myself if I have to, but I would rather not at the moment. In regards to the "new" gdbus, would it be possible to access the verb-list as well? I assume probably not, just thought I would check.
Similarly, I don't suppose it is possible to write an extension that it is registered as an action rather than (or in addition to) a verb?
You can currently use verbs as actions (the long term goal is to replace verbs piece by piece with actions).
What I did not explain clearly before: It's currently probably not possible to control an already running instance of Inkscape via gdbus, but only a new one. We currently set `
Gio::APPLICATION_NON_UNIQUE
` which results in inkscape running parallel processes. This should change at some point, but currently causes some regressions.