flameshot icon indicating copy to clipboard operation
flameshot copied to clipboard

flameshot gui from cli does nothing. dbus error UnknownMethod: "No such interface “org.freedesktop.portal.Screenshot”

Open smoak opened this issue 2 years ago • 8 comments

Flameshot Version

$ flameshot --version Flameshot v12.1.0 (-) Compiled with Qt 5.15.5

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

Arch Linux (Linux 2TKZ9K3 5.15.60-1-lts #1 SMP Thu, 11 Aug 2022 14:09:59 +0000 x86_64 GNU/Linux)

Description

Opening up a terminal, typing flameshot gui and no screenshot interface shows up nor tray icon. It does appear that flameshot is running though (via ps). I am running sway and have the following installed:

  • xdg-desktop-portal - 1.15.0-1
  • xdg-desktop-portal-wlr - 0.6.0-1
  • grim - 1.4.0-2
  • sway - 1:1.7-9
  • qt5-base - 5.15.5+kde+r174-1

I execute sway like:

#!/bin/bash
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export QT_QPA_PLATFORM=wayland
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_DESKTOP=sway
exec sway

And in my sway config:

exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec hash dbus-update-activation-environment 2>/dev/null && \
     dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

Running dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop

I see the following error after executing flameshot gui from a terminal:

method call time=1660588061.129953 sender=:1.768 -> destination=org.freedesktop.portal.Desktop serial=15 path=/org/freedesktop/portal/desktop
; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "1913a5ed852b4f2ca158b993b94015e3"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
error time=1660588061.130109 sender=:1.8 -> destination=:1.768 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=15
   string "No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop"

Steps to reproduce

  1. run flameshot gui from cli
  2. See no tray icon nor flameshot screenshot gui

Screenshots or screen recordings

No response

System Information

  1. Arch Linux (Linux 2TKZ9K3 5.15.60-1-lts #1 SMP Thu, 11 Aug 2022 14:09:59 +0000 x86_64 GNU/Linux)
$ swaymsg -t get_outputs
Output HDMI-A-1 'Unknown G32QC A 21360B003243' (focused)
  Current mode: 2560x1440 @ 59.951 Hz
  Position: 0,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: term
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    2560x1440 @ 59.951 Hz
    3840x2160 @ 60.000 Hz
    3840x2160 @ 59.940 Hz
    2560x1440 @ 119.998 Hz
    1920x1080 @ 143.853 Hz
    1920x1080 @ 120.000 Hz
    1920x1080 @ 119.880 Hz
    1920x1080 @ 60.000 Hz
    1920x1080 @ 60.000 Hz
    1920x1080 @ 59.940 Hz
    1680x1050 @ 59.883 Hz
    1280x1024 @ 75.025 Hz
    1280x1024 @ 60.020 Hz
    1440x900 @ 59.901 Hz
    1280x720 @ 120.000 Hz
    1280x720 @ 119.880 Hz
    1280x720 @ 60.000 Hz
    1280x720 @ 59.940 Hz
    1024x768 @ 75.029 Hz
    1024x768 @ 70.069 Hz
    1024x768 @ 60.004 Hz
    800x600 @ 75.000 Hz
    800x600 @ 72.188 Hz
    800x600 @ 60.317 Hz
    800x600 @ 56.250 Hz
    720x576 @ 50.000 Hz
    720x576 @ 50.000 Hz
    720x480 @ 60.000 Hz
    720x480 @ 60.000 Hz
    720x480 @ 59.940 Hz
    720x480 @ 59.940 Hz
    640x480 @ 75.000 Hz
    640x480 @ 72.809 Hz
    640x480 @ 66.667 Hz
    640x480 @ 60.000 Hz
    640x480 @ 59.940 Hz
    720x400 @ 70.082 Hz

Output eDP-1 'Chimei Innolux Corporation 0x13B6 0x00000000' (inactive)
  Available modes:
    1920x1080 @ 60.002 Hz
    1920x1080 @ 48.001 Hz
$ flameshot --version
Flameshot v12.1.0 (-)
Compiled with Qt 5.15.5

$ inxi --width 80 --system --graphics
zsh: command not found: inxi

$ loginctl show-session $(loginctl show-user $(whoami) -p Display --value) -p Type --val
wayland

$ xrandr --listactivemonitors
Monitors: 1
 0: +XWAYLAND0 2560/700x1440/390+0+0  XWAYLAND0
 
$ lspci | grep -i 'vga\|3d\|2d'
0000:00:02.0 VGA compatible controller: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] (rev 01)

$ lshw -class display
zsh: command not found: lshw

$ uname -a
Linux 2TKZ9K3 5.15.60-1-lts #1 SMP Thu, 11 Aug 2022 14:09:59 +0000 x86_64 GNU/Linux

smoak avatar Aug 15 '22 18:08 smoak

Update: downgrading xdg-desktop-portal (1.15.0-1 => 1.14.6-1) fixes the issue. According to the 1.15.0 release notes (https://github.com/flatpak/xdg-desktop-portal/releases):

Make the Screenshot portal request permission to take screenshots. 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.

Perhaps this change is what's causing the issue?

smoak avatar Aug 15 '22 21:08 smoak

I reported it upstream just in case https://github.com/flatpak/xdg-desktop-portal/issues/861

smoak avatar Aug 15 '22 22:08 smoak

@GeorgesStavracas what do you think? is this related to that PR?

mmahmoudian avatar Aug 16 '22 05:08 mmahmoudian

downgrading xdg-desktop-portal (1.15.0-1 => 1.14.6-1) fixes the issue

I'd like to add that I'm experiencing this same issue. However, downgrading to this version did not workaround it. Were there more steps than simply downgrading?

ndcontini avatar Sep 15 '22 13:09 ndcontini

downgrading xdg-desktop-portal (1.15.0-1 => 1.14.6-1) fixes the issue

I'd like to add that I'm experiencing this same issue. However, downgrading to this version did not workaround it. Were there more steps than simply downgrading?

Yes. Beside the downgrade, make sure that you set XDG_CURRENT_DESKTOP=sway before you lunch sway. I use /etc/environment to set it.

WaleedMortaja avatar Sep 16 '22 07:09 WaleedMortaja

Thank you for the reply. I checked my environment, and that is already set. However I'm still having this issue. I followed the other steps here a long time ago: https://github.com/flameshot-org/flameshot/blob/master/docs/Sway%20and%20wlroots%20support.md

Note that flameshot was working for me with sway at one point, and I only just recently noticed that it no longer works.

ndcontini avatar Sep 16 '22 13:09 ndcontini

Thank you for the reply. I checked my environment, and that is already set. However I'm still having this issue. I followed the other steps here a long time ago: https://github.com/flameshot-org/flameshot/blob/master/docs/Sway%20and%20wlroots%20support.md

Note that flameshot was working for me with sway at one point, and I only just recently noticed that it no longer works.

Sorry to hear that. I am not sure where the problem is.

I am new to sway and I had had the same problem but it is working for me now. I have not followed all the steps in the link, I skipped some steps as long as it works.

Currently I have the following packages installed (I am not sure if the last one is related)

xdg-desktop-portal 1.14.6-1
xdg-desktop-portal-wlr 0.6.0-1
grim 1.4.0-2
flameshot 12.1.0-1
qt5-wayland 5.15.6+kde+r43-2

I set only two variables (actually, the first is not necessary for flameshot according to my experimentation, but I have it for other application)

/etc/environment

QT_QPA_PLATFORM=wayland
XDG_CURRENT_DESKTOP=sway

I have not made the said edit in the sway config (expect that I had made a bind for Print to flameshot gui).

I run sway directly, not from a luncher script. I later moved to lunch it from sddm-git 0.19.0.141.ge67307e-1 AUR, but lunching it directly from tty still makes flameshot work.

I hope my comment may give a hint for a missing step or package.

WaleedMortaja avatar Sep 17 '22 16:09 WaleedMortaja

use xdg-desktop-portal 1.14.6-1 is ok, 1.15.0-1 still failed.

fakeczg avatar Sep 20 '22 02:09 fakeczg

use xdg-desktop-portal 1.14.6-1 is ok, 1.15.0-1 still failed.

Thanks, downgrade helped

ghost avatar Oct 09 '22 12:10 ghost

Because sway run with systemd user service to read environment, add XDG_CURRENT_SESSION to exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_CURRENT_SESSION. The docs should be updated

NgoHuy avatar Oct 31 '22 03:10 NgoHuy

As reported in xdg-desktop-portal, this is an issue with xdg-desktop-portal-wlr. There is a newer v2 version of the Screenshot D-Bus API that is now implemented in xdg-desktop-portal-wlr. Closing this issue as it is not a flameshot specific issue. However, as of this writing a newer release of xdg-desktop-portal-wlr has not been released so if you are running into issues you have 2 options:

  • downgrading xdg-desktop-portal (1.15.0-1 => 1.14.6-1)
  • compile xdg-desktop-portal-wlr yourself from source to pick up the newer Screenshot API

smoak avatar Oct 31 '22 03:10 smoak

As reported in xdg-desktop-portal, this is an issue with xdg-desktop-portal-wlr. There is a newer v2 version of the Screenshot D-Bus API that is now implemented in xdg-desktop-portal-wlr. Closing this issue as it is not a flameshot specific issue. However, as of this writing a newer release of xdg-desktop-portal-wlr has not been released so if you are running into issues you have 2 options:

* downgrading xdg-desktop-portal (1.15.0-1 => 1.14.6-1)

* compile xdg-desktop-portal-wlr yourself from source to pick up the newer Screenshot API

I wonder why archlinux exported to systemd user environment then it worked again.

NgoHuy avatar Oct 31 '22 03:10 NgoHuy

xdg-desktop-portal 1.16.0 is released ~~and it works. I think there is no need for the downgrade anymore.~~ EDIT: logging out was not enough for testing. After making a reboot, it stopped working again. Downgrading is still required to make it work.

WaleedMortaja avatar Dec 13 '22 05:12 WaleedMortaja

@WaleedMortaja the issue is not only with xdg-desktop-portal but xdg-desktop-portal-wlr as well. 0.6.0 is the latest release of xdg-desktop-portal-wlr which does NOT implement the screenshot portal v2. This is required with newer (> 1.14.x) versions of xdg-desktop-portal. Simply upgrading xdg-desktop-portal to the latest will not fix it. As noted in my comment above:

you have 2 options:

  • downgrading xdg-desktop-portal (1.15.0-1 => 1.14.6-1)
  • compile xdg-desktop-portal-wlr yourself from source to pick up the newer Screenshot API

A 3rd option would be to bug the author(s) of xdg-desktop-portal-wlr to cut a new release since the screenshot portal v2 code has been merged.

smoak avatar Dec 14 '22 17:12 smoak

~~A 3rd option would be to bug the author(s) of xdg-desktop-portal-wlr to cut a new release~~ A 3rd option would be to (nicely) ask the author(s) of xdg-desktop-portal-wlr to cut a new release for us - maybe link to this issue if it hasn't been linked already in their issues - or update their issue if it already has been linked.

There, fixed it for you^^ EDIT: Removed phrasing presuming the automation of releases through PRs.

x10an14 avatar Dec 14 '22 17:12 x10an14

@x10an14 i am confused, what would the PR be? The code has already been merged to xdg-desktop-portal-wlr, it just needs a new release. I'm not aware of a way to submit a PR to do that.

smoak avatar Dec 14 '22 17:12 smoak

@x10an14 i am confused, what would the PR be? The code has already been merged to xdg-desktop-portal-wlr, it just needs a new release. I'm not aware of a way to submit a PR to do that.

You raise a valid point, my apologies. I presumed they had the build process automated in such a way that one could trigger a new deployment/release.

Updated my comment to reflect this.

x10an14 avatar Dec 16 '22 13:12 x10an14