Colour Picking on Wayland
Open, Needs TriagePublic

Description

Currently, many areas in a Plasma Wayland session that attempt to do colour picking don't use the KWin API, because they haven't been made to support it. Porting KDE things that don't use this API to use it (or an equivalent, such as the screenshot portal's PickColor method) should be done.

cblack created this task.Apr 29 2020, 4:33 PM
apol added a subscriber: apol.Apr 29 2020, 11:23 PM

There's the org.kde.plasma.colorpicker that does this.

It's using dbus:

void KWinWaylandGrabber::pick()
{
    QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KWin"),
                                                      QStringLiteral("/ColorPicker"),
                                                      QStringLiteral("org.kde.kwin.ColorPicker"),
                                                      QStringLiteral("pick"));
    auto call = QDBusConnection::sessionBus().asyncCall(msg);
    QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
    connect(watcher, &QDBusPendingCallWatcher::finished, this,
        [this] (QDBusPendingCallWatcher *watcher) {
            watcher->deleteLater();
            QDBusPendingReply<QColor> reply = *watcher;
            if (!reply.isError()) {
                setColor(reply.value());
            }
        }
    );
}

Maybe it would be easier if you explained what you're trying to achieve?

cblack added a comment.EditedApr 29 2020, 11:29 PM
In T13060#228603, @apol wrote:

There's the org.kde.plasma.colorpicker that does this.

It's using dbus:

- snip -

Maybe it would be easier if you explained what you're trying to achieve?

Ah. That's entirely dysfunctional for me, so I assumed it was attempting to grab via X11 shenanigans and not via an API.

Still, there's areas in an average KDE session that need to use this API but don't on Wayland, and I think something cross-desktop would be appreciated for non-KDE applications.

Edit: some research shows the Screenshot portal has a PickColor method.

apol added a comment.Apr 29 2020, 11:34 PM

Sure, but this is not what this ticket is about.

In T13060#228606, @apol wrote:

Sure, but this is not what this ticket is about.

Will edit.

cblack renamed this task from Colour picking on Wayland to Colour Picking on Wayland.Apr 29 2020, 11:39 PM
cblack updated the task description. (Show Details)
apol awarded a token.Apr 29 2020, 11:46 PM
rchdm added a subscriber: rchdm.Feb 23 2023, 11:32 AM