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

No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop #246

Open
kyechou opened this issue Nov 19, 2022 · 10 comments

Comments

@kyechou
Copy link

kyechou commented Nov 19, 2022

DBus says "No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop" while taking screenshots through xdg-desktop-portal-wlr.

My setup

  • Arch Linux (Linux arch 6.0.9-arch1-1)
  • xdg-desktop-portal 1.15.0-1 (also tried 1.14.6, which worked without any issue)
  • xdg-desktop-portal-wlr 0.6.0-1 (also tried c83b3cc with the same error)
  • sway 1:1.7-10 or Hyprland 0.18.0beta-1

More description

Essentially it's the same issue as flatpak/xdg-desktop-portal#861 (the exact same situation and output), where it's mentioned that c83b3cc should fix the problem, but it seems the issue still exists, both in sway and Hyprland. The same issue also occurred in Wayfire, according to flameshot-org/flameshot#2959 (comment).

Steps to reproduce

  • Install xdg-desktop-portal 1.15.0 and the latest commit of xdg-desktop-portal-wlr.
  • Remove all other xdg-desktop-portal backend except for xdg-desktop-portal-wlr.
  • Run flameshot gui or the test script.

Related issues:

@smlx
Copy link

smlx commented Nov 19, 2022

Could you try this checklist and report the results?
https://github.com/emersion/xdg-desktop-portal-wlr/wiki/%22It-doesn't-work%22-Troubleshooting-Checklist

@IlyaMZP
Copy link

IlyaMZP commented Nov 19, 2022

You need to install xdg-desktop-portal-gtk too.

@kyechou
Copy link
Author

kyechou commented Nov 19, 2022

Good day!

@smlx thanks for the suggestion! I've gone through the checklist a few times before, and I went through it again just now. Screen sharing through either webRTC (tested on firefox) or OBS works perfectly. But screenshot still doesn't work. All the systemd user units are active, running, and enabled as described in the checklist, and all the environment variables are set as they should.

$ < "/proc/$(pidof xdg-desktop-portal)/environ" tr '\0' '\n' | grep '^WAYLAND_DISPLAY='
WAYLAND_DISPLAY=wayland-1

$ < "/proc/$(pidof xdg-desktop-portal)/environ" tr '\0' '\n' | grep '^XDG_CURRENT_DESKTOP='
XDG_CURRENT_DESKTOP=sway
My wrapper script for running sway (or hyprland)
#!/bin/bash

# Wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export SDL_VIDEODRIVER=wayland
export MOZ_ENABLE_WAYLAND=1
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
export GDK_BACKEND='wayland,x11'
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_QPA_PLATFORM='wayland;xcb'
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1

# GTK themes
export GTK_THEME=Kanagawa-Borderless
export GTK_ICON_THEME=Everforest-Dark
export XCURSOR_THEME=phinger-cursors
export XCURSOR_SIZE=32

exec sway

It may be worth mentioning that I'm testing the setup with solely Intel iGPU, so that hopefully eliminates all the Nvidia-related nonsense.

@IlyaMZP, thanks! I know it will work if xdg-desktop-portal-gtk, xdg-desktop-portal-kde, or other backends are installed, flameshot-org/flameshot#2959 (comment) also mentioned something similar, but I'm not sure why they are required. I'm not really familiar with the code. And if they are required, should they be a dependency of xdg-desktop-portal-wlr?

@IlyaMZP
Copy link

IlyaMZP commented Nov 19, 2022

I'm not sure why they are required. I'm not really familiar with the code. And if they are required, should they be a dependency of xdg-desktop-portal-wlr?

I'm not sure either, but that is what finally made it work for me. You need a way to give an application the permission to take a screenshot, and that permission prompt is part of xdg-desktop-portal-gtk. Maybe there is a way to make it work without xdg-desktop-portal-gtk, but I haven't been able to find one.

@Electrostasy
Copy link

I'm not sure either, but that is what finally made it work for me. You need a way to give an application the permission to take a screenshot, and that permission prompt is part of xdg-desktop-portal-gtk. Maybe there is a way to make it work without xdg-desktop-portal-gtk, but I haven't been able to find one.

So with the updated interface that can request permission, because xdg-desktop-portal-wlr doesn't have a way to ask permission, xdg-desktop-portal instead (possibly) delegates that to the other backends? I see this in the 1.15.0 release notes for xdg-desktop-portal:

Frontends that implement the version 2 of org.freedesktop.portal.impl.Screenshot portal can now be aware that the screenshot permission was granted through the new 'permission_store_checked' option, and skip any kind of dialog when that is the case.

I am unable to locate where such an option is set in any of the portal backends, though, but from what I can observe, it could be relevant to this issue (using solely xdg-desktop-portal-wlr).

@mildred
Copy link
Contributor

mildred commented Feb 8, 2023

With xdg-dektop-portal-gtk installed, I still have issues. I could have screenshoot once only, and then I get this in my logs:

Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable

Apparently, it fails to detect the correct interface to ask for permissions.

I tried restarting xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk

Apparently, it does not detect the installed gtk portal

@mildred
Copy link
Contributor

mildred commented Mar 20, 2023

Investigating again and I find back my comment :)

I could make flameshot gui work 9but only once) by manually running xdg-desktop-portal-wlr: /usr/libexec/xdg-desktop-portal-wlr -r -l TRACE. Going through the checklist, all seems ok.

@WaleedMortaja
Copy link

I confirm that upgrading xdg-desktop-portal-wlr from 0.6.0 to 0.7.0 did not solve this issue as it was previously anticipated. However, downgrading xdg-desktop-portal to 1.14.6 works well with xdg-desktop-portal-wlr 0.7.0.

@SuperTux88
Copy link

I had the same problem, but after I also installed xdg-desktop-portal-gtk, and then restarting xdg-desktop-portal, flameshot gui started to work. I wasn't able to downgrade xdg-desktop-portal, as such old versions weren't available anymore in my package manager, but installing the gtk portal in addition to the wlr portal also worked, so maybe that also helps somebody else.

@Kuchteq
Copy link

Kuchteq commented Jul 3, 2024

Installing xdg-desktop-portal-gtk does solve the issue but it makes my wonder why? Since either way we specify wlr in sway-portals.conf as in: org.freedesktop.impl.portal.Screenshot=wlr what does GTK have to do with any of it? I investigated a bit and without gtk, the Screenshot portal doesn't get "turned on/used" based on input from xdg-desktop-portal --replace --verbose. I figured it's the org.freedesktop.impl.portal.Access that gtk provides that makes Screenshotting work. However, ScreenCasting without that portal works fine so I'm wondering why is that the case? Maybe we could say in the readme that gtk is indeed needed for Screenshotting to work instead of only saying that we can set a fallback portal?

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

No branches or pull requests

8 participants