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

Implement portal screenshot creation #142

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

TornaxO7
Copy link
Collaborator

@TornaxO7 TornaxO7 commented Apr 4, 2024

No description provided.

@TornaxO7 TornaxO7 linked an issue Apr 4, 2024 that may be closed by this pull request
@TornaxO7 TornaxO7 marked this pull request as draft April 4, 2024 18:38
@TornaxO7 TornaxO7 marked this pull request as ready for review April 4, 2024 20:46
@TornaxO7 TornaxO7 changed the title Implement dbus backend Implement portal screenshot creation Apr 4, 2024
@TornaxO7
Copy link
Collaborator Author

TornaxO7 commented Apr 4, 2024

Why is the CI stuck?
monkaW

@TornaxO7 TornaxO7 requested a review from eneoli April 4, 2024 21:06
…dcreate_screenshots-creates-blank-screenshots
Cargo.toml Show resolved Hide resolved
@@ -0,0 +1,100 @@
//! The fallback screenshot creator if all previous attempts failed to create the screenshots of a monitor.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desktop Portals are independent of Display protocol. We will need them for gnome on waylant too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh fair, I'll dig into it

pub struct Fallback;

impl ScreenshotCreator for Fallback {
fn create_screenshot(
Copy link
Owner

@eneoli eneoli May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not use the portal?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And is this even used anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not use the portal?

No it doesn't, the fallback creator tries to create an image of the screens on its own. Maybe I should've chosen a better name for it :D

And is this even used anymore?

Yes! If the other creators (like the portal) failed, this fallback version will be called.

@@ -48,6 +54,25 @@ pub enum Error {
/// }
/// ```
pub fn create_screenshots() -> Result<Vec<(OutputInfo, image::DynamicImage)>, Error> {
let creators = [PortalScreenshot::new()?];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we discard native x11 method? We could still use it for all dekstop envs except KDE and GNOME. Also the user has to have the portal installed then, idependent of desktop env

Copy link
Owner

@eneoli eneoli May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using X11 always as fallback is not optimal

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using X11 always as fallback is not optimal

May I ask what you mean here?

/// and return it.
fn create_screenshot(
&self,
conn: &RustConnection,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Portal does not need this. Add is as a paramter to ::new of Fallback

Copy link
Owner

@eneoli eneoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@TornaxO7
Copy link
Collaborator Author

hm... ok, after reading through your comments, I think that there has been a missunderstanding. I thought that we only want to use the portal if the user is on X11 and GNOME or KDE. Will fix it 👍

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

Successfully merging this pull request may close these issues.

X11: backend::create_screenshots creates blank screenshots
2 participants