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

Critical: Invalid reply from DBus: Screenshot is not allowed #727

Closed
oturpe opened this issue Oct 4, 2021 · 17 comments
Closed

Critical: Invalid reply from DBus: Screenshot is not allowed #727

oturpe opened this issue Oct 4, 2021 · 17 comments
Assignees
Labels
Projects

Comments

@oturpe
Copy link

oturpe commented Oct 4, 2021

  • Operating System: Fedora 35 Beta
  • Desktop environment: Gnome 41.0
  • Windowing system: Wayland
  • ksnip installed from official Fedora repositories, ksnip-1.9.1-1.fc35.x86_64

From About ksnip/Version:

  • Version: 1.9.1
  • Build: (nothing is written here)
  • Using: Qt5, X11, KDE Wayland, Gnome Wayland

Ksnip is unable to capture any screenshots.
When I select something from the New combobox,
the ksnip window quickly jumps around the screen a little
and end up in a position very close to its original position.
No screenshot is captured.
If I try to capture a rectangular area,
ksnip lets me to choose the area,
but no screenshot is captured.

Starting ksnip from the command line,
I am able to get some logs.
Apart from some warnings about missing translations,
the only log entries are one row like this
for each attempted screenshot:

Critical: Invalid reply from DBus: Screenshot is not allowed

Notes about Fedora's configuration:
The desktop environment is Gnome 41.0.
Wayland is in use.
Qt by default falls back to XWayland,
but this has been overridden in Fedora:
Qt Wayland By Default On Gnome.
However, the ksnip package reverts the override in this patch.

@DamirPorobic
Copy link
Member

Thanks for reporting. Is this broken with Gnome 41? Was it working with earlier version?
Wayland is a major PITA for screenshota, all DEs doing they own stuff, changing it from version to version, it's a mess.

@DamirPorobic DamirPorobic added this to To do in v1.9.2 via automation Oct 4, 2021
@oturpe
Copy link
Author

oturpe commented Oct 4, 2021

Yes, this was working at some point in Fedora 34,
which has Gnome 40.
And yes, Wayland is involved,
because if I switch to X11, this problem disappears.

@DamirPorobic
Copy link
Member

I'll have a look into it when I find some time. Similar issue with KDE, a DBus call that was working stopped working with a never version, they're allowing it only for they own applications.

@grulja
Copy link

grulja commented Oct 6, 2021

Hi, your best bet will be to go through xdg-desktop-portal. This way you will make sure it works for both KDE and GNOME, while using just one API. Benefit of this is that this will also work as Flatpak or SNAP.

Here is example how this API is used.

@DamirPorobic
Copy link
Member

@grulja We support that already but it's not the default for Wayland, you have to enable it through settings (this option is not grayed out when you're using wayland).
image

My problem with the xdg-desktop-portal is that it's not consistent, it looks and behaves different on KDE, GNOME and Sway. What annoys me the most is that requirement of additional confirmations, you want to take a quick screenshot and have to push a button to start the screenshot process, wait for the popup window to show up, then select what screenshot type you want, then select a region, than confirm again. It's just not practical.
Then you look at Spectacle, KDEs own screenshot tool, where you don't have to use this portal and can take directly screenshots without going through the hassle of an additional dialog. Feels a bit like pushing the completions out.

@grulja
Copy link

grulja commented Oct 6, 2021

In that case this https://invent.kde.org/ballogy/spectacle/-/blob/master/desktop/org.kde.spectacle.desktop.cmake#L164 is what you need for direct screenshot to work.

@grulja
Copy link

grulja commented Oct 6, 2021

You can see xdg-desktop-portal-kde has the same thing.

@DamirPorobic
Copy link
Member

This can be added to ksnip's desktop file and would allow us using the same dbus calls as Spectacle?

@grulja
Copy link

grulja commented Oct 6, 2021

This can be added to ksnip's desktop file and would allow us using the same dbus calls as Spectacle?

Yes. At least as of now there is no control in KWin with list of applications where this should be allowed so it should work just fine.

@DamirPorobic
Copy link
Member

That's nice, thank you for that hint, will add it tonight to the next patch.
I'm wondering if there is something similar for GNOME as I imagine the issue happened here for the same reason, a DBus call is not allowed anymore for external applications.

@oturpe
Copy link
Author

oturpe commented Oct 6, 2021

I can confirm that the Force Generic Wayland Screenshot allows taking screenshots again.
But it is just like you say,
the ksnip experience is replaced with a different thing that requires a lot of clicks.

Also, the option only takes effect after restarting ksnip,
it would be more understandable if there was some notification about that.

A really minor observation:
When any of the tickboxes in settings is clicked,
all the entries to the left are greyed out
(but will recover when clicked):
kuva

@DamirPorobic
Copy link
Member

It looks like this is the way to go now. Gnome has disabled access to this DBus interface for not whitelisted application and whitelisted are only Gnome's applications. This is the current state of Wayland development, stuff gets disabled without a solution for the majority of users, usability seems to be irrelevant for them.

The merge request that brought the change: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970
Flameshot having the same issue: flameshot-org/flameshot#1910

What I can try to do is add some check that checks if we are running Gnome Version >= 41 and in that case use by default the Portal screenshots.

@DamirPorobic DamirPorobic moved this from To do to In progress in v1.9.2 Oct 29, 2021
@DamirPorobic DamirPorobic self-assigned this Oct 29, 2021
@DamirPorobic
Copy link
Member

Here the feature request to change the portal behavior so it allows only asking once for screenshot permission and allows requesting specific type of screenshot. flatpak/xdg-desktop-portal#649

@DamirPorobic
Copy link
Member

DamirPorobic commented Oct 29, 2021

The xdg-desktop-portal screenshots are going to be enforced now for Gnome 41, I'm quite sure that the users are not going to like it but there is nothing we can do about it as long as Gnome developers don't allow us access to the DBus interface that they use for Gnome's own screenshot tools. Either don't use Wayland or convince the portal and Gnome developers to improve the usability. I've added a comments in the Readme Wayland section. Nothing to do here for us anymore.

v1.9.2 automation moved this from In progress to Done Oct 29, 2021
@oturpe
Copy link
Author

oturpe commented Oct 30, 2021

Thank you for researching the issue.
Let us hope that xdg-desktop-portal gets improved in this respect.
I went to their issue linked above and did what little is could do there,
i.e. gave thumbs up to everything that would help resolve this.

What I can try to do is add some check that checks if we are running Gnome Version >= 41 and in that case use by default the Portal screenshots.

Will this be implemented?

@DamirPorobic
Copy link
Member

Let's hope that this gets enough attention. KDE Plasma btw has allowed setting a property in the desktop file that allows still accessing the private API for screenshots.

Will this be implemented?

That should be implemented already, you can test it with the continuous build.

@oturpe
Copy link
Author

oturpe commented Oct 30, 2021

Will this be implemented?

That should be implemented already, you can test it with the continuous build.

Thank you, tested, it works as expected.

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

No branches or pull requests

3 participants