Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify screenshot capture and add support for wayland #1053

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

evan-a-a
Copy link
Contributor

@evan-a-a evan-a-a commented Apr 19, 2023

pyscreenshot supports capturing screenshots via numerous backends and can automatically select the best one depending on platform. This enables capturing of the QR code on wayland-based desktops while maintaining support for Windows and X11 desktops.

Fixes #1010

@evan-a-a evan-a-a force-pushed the wayland_screenshot branch from 7360348 to 50f390c Compare April 19, 2023 21:11
@evan-a-a evan-a-a marked this pull request as draft April 20, 2023 16:47
@evan-a-a evan-a-a force-pushed the wayland_screenshot branch from 50f390c to c3dc2d0 Compare April 24, 2023 17:39
@evan-a-a evan-a-a marked this pull request as ready for review April 24, 2023 17:40
pyscreenshot supports capturing screenshots via numerous backends
and can automatically select the best one depending on platform.
This enables capturing of the QR code on wayland-based desktops
while maintaining support for Windows and X11
@evan-a-a evan-a-a force-pushed the wayland_screenshot branch from c3dc2d0 to 0e23fba Compare April 24, 2023 17:43
@evan-a-a
Copy link
Contributor Author

This should be working now, at least on Linux. I'll give it a checkout on Windows once the test build is done. I don't have a macOS machine available to test.

Small note, I tested this in the Flatpak but there's a small bug in pyscreenshot that causes an issue. I am going to patch pyscreenshot to fix the behavior, but I don't think this should block merging this request. The dependency can be updated later.

@fdennis
Copy link
Contributor

fdennis commented Apr 26, 2023

Hi, and thanks for the PR!
We have tried the builds on win10, win11, and macOS. Unfortunately, scanning does not work properly. When pressing "Scan QR code" the spinner spins and never stops. Are you able to reproduce this on your Windows?

@trinitronx
Copy link

trinitronx commented Jun 23, 2023

I tested merging this (+ resolving conflicts) with latest main @ e753fac on Manjaro Sway with Wayland 1.22.0, and gnome-screenshot 41.0+r25+g45f08f0-1. Unfortunately, I was also able to reproduce the spinner bug mentioned by @fdennis. However, it's likely that the symptoms are similar but the underlying cause may be different on Windows versus Linux + Wayland. It appears that at least on Wayland wlroots-based compositors (e.g. without X11, nor Gnome Shell + Mutter (as compositor), gnome-screenshot does not support screen capture.

Upstream bug report is here: GNOME/gnome-screenshot#201. (It was closed as "Won't Fix", given the dependency on non-Wayland compositor + Gnome Shell).

So, if GNOME devs are not interested in fixing this for Wayland, that leaves some other options.

Not sure about what might be going on with the spinner issue on Windows' side.

@liferooter
Copy link

liferooter commented Jun 23, 2023

Guys, just use portals for Wayland. It's generally impossible to implement a universal screenshot tool for Wayland without using something like portals, thanks to Wayland protocol. GNOME devs physically can't fix that issue. Also screenshoters for Sway (that uses wl-roots extra protocols) won't work on GNOME or KDE, or generally any non-wl-roots Wayland compositor. Don't implement more and more broken hacks. Just use portals, generic API to do that.

Documentation for the portal you need: https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Screenshot

@sofiedotcafe
Copy link

sofiedotcafe commented Mar 24, 2024

The same could be done for #1399

The current thing just uses an zenity based menu afaik but that probably needs to be addressed upstream
miguelpruivo/flutter_file_picker#1451
miguelpruivo/flutter_file_picker#1275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Use XDG Desktop Portals on Linux instead of screenshot tools
5 participants