Yubico / yubioath-flutter

Yubico Authenticator for Desktop (Windows, macOS and Linux) and Android
https://developers.yubico.com/yubioath-flutter/
Apache License 2.0
986 stars 135 forks source link

Use XDG Desktop Portals on Linux instead of screenshot tools #1010

Open liferooter opened 1 year ago

liferooter commented 1 year ago

The application needs an ability to scan QR code from screen, but arbitrary reading from screen is not supported on Wayland for security reasons. But an ability to get screen content when needed is needed sometimes. So there is an API for that. There is a generic API for permission-based access granting on Linux. It's called XDG Desktop Portals. There is a portal for taking screenshot.

It's already used in some apps for the same thing. For example, Authenticator, an application for generating two-factor codes, uses the portal to scan QR code.

There are some advantages of this way to scan QRs from the screen:

trinitronx commented 3 weeks ago

Solving this issue would get the QR code screenshot feature working for Wayland systems.

Adding the following error message from Sway + Wayland system for SEO visibility:

11:46:02.007 [helper] ERROR: 
11:46:02.007 [helper] ERROR: (gnome-screenshot:1642482): Handy-WARNING **: 11:46:02.007: Using GtkSettings:gtk-application-prefer-dark-theme together with HdyStyleManager is unsupported. Please use HdyStyleManager:color-scheme instead.
11:46:02.149 [helper] ERROR: 
11:46:02.149 [helper] ERROR: ** (gnome-screenshot:1642482): WARNING **: 11:46:02.149: Unable to use GNOME Shell's builtin screenshot interface: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
11:46:02.149 [helper] ERROR: 
11:46:02.149 [helper] ERROR: ** (gnome-screenshot:1642482): CRITICAL **: 11:46:02.149: Unable to capture a screenshot of any window
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RpcResponse.error(status: invalid-command, message: Invalid parameters: Unable to capture screenshot, body: {})