DBus service for screenshots.

Boudhayan Gupta bgupta at kde.org
Fri Sep 25 08:09:00 PDT 2015


Hi,

I'm moving this discussion over to the xdg mailing list, as per
suggestions from the dbus list.

On 25 September 2015 at 04:24, Emmanuele Bassi <ebassi at gmail.com> wrote:
> Hi;
>
> On 24 September 2015 at 23:25, Boudhayan Gupta <bgupta at kde.org> wrote:
>> Hi,
>>
>> In December we'll be releasing a new screenshot app for KDE. We've
>> implemented a generic DBus interface for this app, and I'm posting
>> this to the dbus mailing list as others may be interested in this idea
>> and may want to implement it in their own desktop environments.
>>
>> The service we've implemented is called org.freedesktop.Screenshot
>> (we're using the freedesktop namespace because we truly want the
>> service to be DE or platform agnostic).
>
> Commendable spirit, but that's not how it works — we've been bitten by
> this in the past already. Please, use org.kde.* for your DBus
> interfaces, and *then* propose a org.freedesktop.* interface up for
> discussion. Otherwise you'll have to start versioning your own methods
> because any shared interface will likely not map to what you expose
> right now.

I'm going to move this over to the org.kde.* namespace for now until
we can all agree on something for a freedesktop API.

We haven't had any releases yet, so thankfully no damage was done.

>
> Implementing multiple interfaces is easy; breaking them because you
> proposed them for discussion *after* release is going to be painful
> for everybody.
>
>> The XML definition of the
>> interface is available here:
>> https://raw.githubusercontent.com/KDE/spectacle/master/dbus/org.freedesktop.Screenshot.xml
>>
>> You'll notice that we define 4 different types of screenshots that can
>> be taken, and a StartAgent method. The StartAgent method should just
>> start the application GUI, the other 4 methods should take the
>> appropriate shot, save the image in a default location, and quit.
>
> StartAgent would show the UI? Why? That can be done with a simple hot
> key, or via DBus activation of a service, instead of asking a service
> to spawn another service. For instance, if I want to show a dialog to
> save the screenshot I just took, the gnome-screenshot tool is what I
> will launch. There's another consideration that applies to Wayland:
> applications like GIMP (or Krita) may ask the compositor to take a
> screenshot; this means that the UI is already running, and it most
> definitely is not something that should be spawned by the compositor
> itself in reply to a DBus method call. If you want to keep the
> StartAgent method then it's probably good to ensure in the
> documentation that the method is not mandatory.

The use-case for StartAgent is simple - what if a supervisor (such as
the compositor on Wayland) is providing the service, but a separate
application (agent) provides manipulation, editing, saving etc.
functionality?

> The API is also missing the ability to take a screenshot of an area.
> For reference, this is the DBus interface that GNOME Shell provides:
> https://git.gnome.org/browse/gnome-shell/tree/data/org.gnome.Shell.Screenshot.xml

KWin also provides its own D-Bus interface (org.kde.kwin.Screenshot -
an XML definition is unavailable), which is tailored to a compositor's
use-case, is similar to the Gnome Shell interface, and does provide a
method to capture regions.

> GNOME Shell also has an equivalent screencast API, which may be
> interesting to standardise alongside the screenshot one.

I agree, it would be interesting and perhaps quite beneficial if we
can standardise a screenshot (and perhaps also a screencast) interface
at the compositor level over D-Bus that we can all use. Let's have
some more discussions and throw ideas around in the xdg list?

-- Boudhayan


More information about the dbus mailing list