Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Snap crashing when trying to take screenshot under Wayland #389

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

Closed
DamirPorobic opened this issue Jul 27, 2020 · 15 comments
Closed

Snap crashing when trying to take screenshot under Wayland #389

DamirPorobic opened this issue Jul 27, 2020 · 15 comments
Assignees
Labels

Comments

@DamirPorobic
Copy link
Member

According to user reporting on Snapcraft forum the ksnip snap is crashing when trying to take a screenshot under wayland.

@DamirPorobic
Copy link
Member Author

@LyzardKing FYI

@DamirPorobic
Copy link
Member Author

This also requires changing the dbus?

@LyzardKing
Copy link
Contributor

I think it's the same issue as #390

@DamirPorobic
Copy link
Member Author

Ok, let's move those two to 1.8.0

@DamirPorobic DamirPorobic self-assigned this Jul 29, 2020
@DamirPorobic
Copy link
Member Author

@LyzardKing Do you know how to detect if we are running Wayland or X11 under Snap? Usually we echo XDG_SESSION_TYPE and this variable either contains x11 or wayland string. Works outside a Snap but not inside. It looks like with snap we fail to detect that we are running wayland and try to use X11 ImageGrabber which results in a crash.

@LyzardKing
Copy link
Contributor

I get those strings if I echo XDG_SESSION_TYPE in the snap environment
To test it you can run snap run --shell ksnip and that'll open a bash shell in the snap env

@DamirPorobic
Copy link
Member Author

Thanks, will try that.

@DamirPorobic
Copy link
Member Author

@LyzardKing Any change we can make the old API work with Snap or is our only chance here the new API?

@LyzardKing
Copy link
Contributor

As discussed in #390 I opened a PR with the removal of the hardcoded unity desktop.
It was necessary to show the appindicator, but now it seems to work fine without.

@LyzardKing
Copy link
Contributor

The old API cannot work in the snap because we cannot access /tmp.
And that is not overridable.
The only way to make this work is to use the new API.
Another possibility (but I don't think it's possible) would be to tell gnome to save the screenshots in another tmp folder.
The snap has it's own tmp folder in /tmp/snap.ksnip/tmp.

@LyzardKing
Copy link
Contributor

Or the snap could be made not confined (classic).
In that case it would have full access to the system.

@DamirPorobic
Copy link
Member Author

Another possibility (but I don't think it's possible) would be to tell gnome to save the screenshots in another tmp folder.

This is actually possible, let's keep that as a backup option if the new API doesn't work out

@LyzardKing
Copy link
Contributor

If I set the call to the wayland grabber as:

QDBusInterface interface(QStringLiteral("org.freedesktop.portal.Desktop"), QStringLiteral("/org/freedesktop/portal/desktop"), QStringLiteral("org.freedesktop.portal.Screenshot"));

and pull you commit to use the general screenshot in the snap
I get this error:

Invalid reply from DBus: Type of message, “(ss)”, does not match expected type “(sa{sv})”

@DamirPorobic
Copy link
Member Author

Yes, I got that far too. I need to figure out next with what parameters the screenshot methods needs to be called with. For testing just passed some strings there which seem to be wrong.

@DamirPorobic
Copy link
Member Author

Fixed with #243 we use now the generic wayland portal for taking screenshots under snap.

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

No branches or pull requests

2 participants