flatpak / xdg-desktop-portal

Desktop integration portal
https://flatpak.github.io/xdg-desktop-portal/
GNU Lesser General Public License v2.1
598 stars 193 forks source link

GlobalShortcuts.BindShortcut unclear return value #1350

Open dcz-self opened 6 months ago

dcz-self commented 6 months ago

Operating System

n/a

XDG Desktop Portal version

1.18

XDG Desktop Portal version (Other)

No response

Desktop Environment

Deepin

Desktop Environment (Other)

No response

Expected Behavior

The docs cover all the relevant use cases.

Current Behavior

Disabled shortcuts

BindShortcuts description says:

Each element of the shortcuts array returned by the org.freedesktop.portal.Request::Response signal is a tuple composed of a shortcut id, and a vardict with the following keys:

about the list, and pretty much nothing else. What's missing in particular is whether all shortcuts are expected to come back.

trigger_description (s)

User-readable text describing how to trigger the shortcut for the client to render.

is clearly meant for the application to communicate how to trigger the shortcut. What if the user decided to make the shortcut impossible to trigger? An application assuming that whatever comes back is set may end up printing "Press unset to trigger this", which is silly. On the other hand, if skipped shortcuts are not present in the return value, the application may crash when trying to print a message("Press {} to trigger this", shortcuts["this"]).

Steps to Reproduce

  1. Read BindShortcuts description
  2. Try to understand the return value across different use cases

Anything else we should know?

No response

swick commented 3 weeks ago

I think the intention here is to send back the shortcuts that were bound which might be a subset, including an empty subset of the shortcuts which were passed in the shortcuts array.

KDE seems to have implemented this in a way that it returns as many entries as shortcuts were passed in. The frontend does not have this restriction.

It does make sense to me to clarify that a subset of shortcuts can be returned.