flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
24.41k stars 1.56k forks source link

Cannot take a screenshot Fedora 35 (gnome 41.2) - wayland (non Latin characters in XDG path) #2211

Closed vanheck closed 2 years ago

vanheck commented 2 years ago

Flameshot Version

flameshot.x86_64 0.10.2-3.fc35

Installation Type

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

Operating System type and version

Fedora 35

Description

Hi, I have the same problem as @Yajo here: https://github.com/flameshot-org/flameshot/issues/1910#issuecomment-1001468663 - the issue is closed, but the problem remains.

What happens under Wayland:

https://user-images.githubusercontent.com/973709/147457811-eef340b0-caad-4caf-85be-939a2ed64a0b.mp4

Originally posted by @Yajo in https://github.com/flameshot-org/flameshot/issues/1910#issuecomment-1001468663

I use: Fedora 35 with Gnome 41.2 (wayland), xdg-desktop-portal and xdg-desktop-portal-gnome are also installed.

$ dnf list installed | grep xdg-desktop-portal
xdg-desktop-portal.x86_64                          1.10.1-2.fc35                          @updates                  
xdg-desktop-portal-gnome.x86_64                    41.1-1.fc35                            @fedora                   
xdg-desktop-portal-gtk.x86_64                      1.10.0-2.fc35                          @updates                  

$ dnf list installed | grep flameshot
flameshot.x86_64                                   0.10.2-3.fc35                          @updates

Steps to reproduce

  1. run flameshot gui
  2. accept share screen and get error pop-up "Unable to capture screenshot"

Screenshots or screen recordings

No response

System Information

Wayland, xdg-desktop-portal and xdg-desktop-portal-gnome are also installed.

borgmanJeremy commented 2 years ago

This is really confusing to me because it works fine for me in a clean VM. Have you tried rebooting after installing all the portals?

vanheck commented 2 years ago

Yes, ofcourse. I restarted the system multiple times. I upgraded the system from fedora 34. The flameshot doesn't work after the distro upgrade. :/

Is it possible to debug the problem (somehow)?

borgmanJeremy commented 2 years ago

Is it possible to debug the problem (somehow)? Yes, usually what I do in this type of bug is first use "bustle" to log the DBus calls.

  1. Launch flameshot
  2. Start Bustle
  3. Record Session Bus
  4. Right click on tray icon and hit take screenshot
  5. Stop Bustle recording

Then look for an error in the diagram and report what the error is.

I also just noticed you are using the flatpak and not the native build. I thought you were using the native build so thats what I tried in the VM. I will try the flatpak later. Perhaps use Flatseal and make sure Flameshot has DBus permissions?

vanheck commented 2 years ago

I thought I use native build (not flatpack) - the software center confirms it: obrazek

And errors in Bustle are in org.freedesktop.portal.Request.Close and org.freedesktop.DBus.Properties.GetAll, both errors are org.freedesktop.DBus.Error.UnknownMethod. obrazek

borgmanJeremy commented 2 years ago

In the gif you ran it with flatpak which is why I am confused. You may need to file this as a bug with fedora35 since it works fine on a clean install

vanheck commented 2 years ago

Apologize, the gif / or video file is from the previous comment (I refer to) (Originally posted by @Yajo in #1910 ) - just for the describtion of the same behaviour.

But in my machine is installed by dnf install flameshot.

Have the flameshot app some cache or config (thats its not removed by dnf remove flameshot)?

yajo commented 2 years ago

FWIW I use Fedora Silverblue 35, not just Fedora 35. I guess it shouldn't matter, but just in case...

xvitaly commented 2 years ago

You may need to file this as a bug with fedora35 since it works fine on a clean install

As a Fedora maintainer, I can't do anything with this in downstream. It works fine on my VM with Gnome after installing the xdg-desktop-portal-gnome package.

You should ask GNOME upstream, I think.

vanheck commented 2 years ago

I filed the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2036411 and answer is to resolve the problem with Flameshot and Gnome upstream :/

Where can I ask Gnome upstream?

xvitaly commented 2 years ago

I filed the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2036411

Sorry, but I will close it as this is not a packaging issue and can't be fixed in downstream. It should be reported directly to GNOME/mutter.

Where can I ask Gnome upstream?

https://gitlab.gnome.org/GNOME/mutter/-/issues

xvitaly commented 2 years ago

Ubuntu has the same problem: #2199.

borgmanJeremy commented 2 years ago

No that user simply didn't have the portals installed. I have no idea what's going on here. It works fine in a vm so until someone can explain to to make it occur there really is nothing I can do.

vanheck commented 2 years ago

I've also try to dbus-monitor --session sender=org.flameshot.Flameshot, output is here (not sure if its heplful):

signal time=1641065874.865619 sender=org.freedesktop.DBus -> destination=:1.199 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.199"
signal time=1641065874.865742 sender=org.freedesktop.DBus -> destination=:1.199 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.199"
method call time=1641065877.761169 sender=:1.203 -> destination=org.freedesktop.DBus serial=15 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.a11y.Bus',arg1=''"
method call time=1641065877.761190 sender=:1.203 -> destination=org.freedesktop.DBus serial=16 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameHasOwner
   string "org.a11y.Bus"
method call time=1641065877.761237 sender=:1.203 -> destination=org.freedesktop.DBus serial=17 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.a11y.Bus'"
method call time=1641065877.761258 sender=:1.203 -> destination=org.freedesktop.DBus serial=18 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.a11y.Bus"
method call time=1641065877.761310 sender=:1.203 -> destination=org.a11y.Bus serial=19 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "ScreenReaderEnabled"
method call time=1641065877.761540 sender=:1.203 -> destination=org.a11y.Bus serial=20 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "IsEnabled"
method return time=1641065877.762345 sender=:1.203 -> destination=:1.200 serial=21 reply_serial=2
method call time=1641065877.764456 sender=:1.203 -> destination=org.freedesktop.portal.Desktop serial=22 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1641065877.765670 sender=:1.203 -> destination=org.freedesktop.DBus serial=23 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065877.765681 sender=:1.203 -> destination=org.freedesktop.DBus serial=24 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1641065877.765752 sender=:1.203 -> destination=org.freedesktop.DBus serial=25 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1641065877.765806 sender=:1.203 -> destination=org.freedesktop.DBus serial=26 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.portal.Desktop',path='/org/freedesktop/portal/desktop/request/1_203/203bdc933f6747efadcb0f475b0fd0d3',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1641065877.765812 sender=:1.203 -> destination=org.freedesktop.DBus serial=27 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065877.765824 sender=:1.203 -> destination=org.freedesktop.DBus serial=28 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1641065877.765885 sender=:1.203 -> destination=org.freedesktop.portal.Desktop serial=29 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "203bdc933f6747efadcb0f475b0fd0d3"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
method call time=1641065880.177295 sender=:1.203 -> destination=org.freedesktop.portal.Desktop serial=30 path=/org/freedesktop/portal/desktop/request/1_203/203bdc933f6747efadcb0f475b0fd0d3; interface=org.freedesktop.portal.Request; member=Close
method call time=1641065880.178117 sender=:1.203 -> destination=org.freedesktop.Notifications serial=31 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1641065880.179404 sender=:1.203 -> destination=org.freedesktop.DBus serial=32 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641065880.179559 sender=:1.203 -> destination=org.freedesktop.DBus serial=33 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1641065880.180202 sender=:1.203 -> destination=org.freedesktop.Notifications serial=34 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Informace Flameshot"
   string "Nelze zachytit obrazovku"
   array [
   ]
   array [
   ]
   int32 5000
method call time=1641065880.192888 sender=:1.203 -> destination=org.freedesktop.DBus serial=35 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641065880.192967 sender=:1.203 -> destination=org.freedesktop.DBus serial=36 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.portal.Desktop',path='/org/freedesktop/portal/desktop/request/1_203/203bdc933f6747efadcb0f475b0fd0d3',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1641065880.192987 sender=:1.203 -> destination=org.freedesktop.DBus serial=37 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065880.193007 sender=:1.203 -> destination=org.freedesktop.DBus serial=38 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641065880.193092 sender=:1.203 -> destination=org.freedesktop.DBus serial=39 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641065880.193185 sender=:1.203 -> destination=org.freedesktop.DBus serial=40 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1641065880.193514 sender=:1.203 -> destination=org.freedesktop.Notifications serial=41 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Informace Flameshot"
   string "Nelze zachytit obrazovku"
   array [
   ]
   array [
   ]
   int32 5000
method call time=1641065880.200721 sender=:1.203 -> destination=org.freedesktop.DBus serial=42 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
signal time=1641065880.251421 sender=:1.203 -> destination=(null destination) serial=43 path=/; interface=org.flameshot.Flameshot; member=captureFailed
   uint32 4269929705
vanheck commented 2 years ago

I opened the issue also here: https://gitlab.gnome.org/GNOME/mutter/-/issues/2072

mmahmoudian commented 2 years ago

@vanheck

I opened the issue also here: > https://gitlab.gnome.org/GNOME/mutter/-/issues/2072

Aaaaand they closed it for you without even reading the basis of your report.

Thanks for taking the time to do this and report it upstream. Let's stay hopeful that they read your comment which you posted after they closed the ticket.

vanheck commented 2 years ago

@vanheck

I opened the issue also here: > https://gitlab.gnome.org/GNOME/mutter/-/issues/2072

Aaaaand they closed it for you without even reading the basis of your report.

Thanks for taking the time to do this and report it upstream. Let's stay hopeful that they read your comment which you posted after they closed the ticket.

Ok, (probably due to my laziness) to use the other's video to preview similar behaviour. I didn't notice that output on the preview video is little bit different than in my case. Next time, I'll be better with filling the bug.

My video with the problem is here: https://www.youtube.com/watch?v=s6Tbugr-QDw&ab_channel=JohnvanHeck

vanheck commented 2 years ago

Could be a trouble here? https://gitlab.gnome.org/GNOME/mutter/-/issues/2072#note_1344961

Good point is that I have the screenshot files in path /home/vanheck/Obrázky/Screenshot-69.png (OS localized as cs_CZ) and not /home/vanheck/Obr%C3%A1zky/Screenshot-69.png.

xvitaly commented 2 years ago

@vanheck Can you try another directory with only Latin characters?

vanheck commented 2 years ago

I'm not sure if I'm able to change this behaviour - the screenshot is saved into folder /home/vanheck/Obrázky imediately I click on the Share screen in the gnome dialog (this is probably default folder for gnome screenshots?) after flameshot gui command. In Flameshot I have set the default path /home/vanheck/Dokumenty:

obrazek

vanheck commented 2 years ago

Yes, confirm, Flameshot works well if I change the default path for Pictures with Latin characters only (XDG_PICTURES_DIR in ~/.config/user-dirs.dirs).

borgmanJeremy commented 2 years ago

Thanks for persisting and finding the root cause, that's something we can can fix.

vanheck commented 2 years ago

@borgmanJeremy you’re welcome. Please, let me know when will be the fix released.

vanheck commented 2 years ago

Another behaviour of Flameshot is: After flameshot gui, the screenshot picture is saved into XDG_PICTURES_DIR and when clicking on the Cancel button, the picture file persist in the XDG_PICTURES_DIR.

karshPrime commented 2 years ago

I filed the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2036411 and answer is to resolve the problem with Flameshot and Gnome upstream :/

Where can I ask Gnome upstream?

Can confirm its not a Gnome issue. Only today i switched from Arch Gnome to Fedora Gnome, and just like you I'm getting same issues on my fedora machine. flameshot gui worked as it should on my arch built but is giving me same error as you.

yajo commented 2 years ago

Weird, I did the change from https://github.com/flameshot-org/flameshot/issues/2211#issuecomment-1003722214 and log out, log in under Wayland. It works also!

I can also see https://github.com/flameshot-org/flameshot/issues/2211#issuecomment-1003724687, before doing that.

What makes all this even more weird is that I configured a different save path that happens to not have non-ascii characters:

2022-01-03_07-44

But flameshot still writes those temporary files into XDG_PICTURES_DIR.

My guess is that temporary files should go into XDG_CACHE_DIR (besides supporting non-English use cases 😋 for XDG_PICTURES_DIR).

vanheck commented 2 years ago

@gormih the better would be whole dbus log, not only for Flameshot, dbus-monitor --session > dbus.log

gormih commented 2 years ago

@vanheck
i try build the flameshot from current source code in this repository. is worked normally. I include video in in the near future

vanheck commented 2 years ago

@Yajo I guess it is expected behaviour. Flameshot call the xdg API (xdg-desktop-portal-gnome) to take a screenshot and API capture screen then API save image in default path XDG_PICTURES_DIR and send the path to flameshot. Flameshot take the image on the path received from xdgAPI - create a new edited image and save on the path, you have set in the settings (and remove old picture from xdgAPI).

But there is a question: xdg capture the screen before I allow that (by clickcing on the Share button in gnome dialog) - is it the right behaviour? guess not... but it is another issue.

vanheck commented 2 years ago

@gormih please check https://github.com/flameshot-org/flameshot/issues/2211#issuecomment-1003714380 and https://github.com/flameshot-org/flameshot/issues/2211#issuecomment-1003722214

If you have in XDG_PICTURES_DIR Latin characters only (e.g. /home/user/Pictures), you have no problem with flameshot.

gormih commented 2 years ago

@vanheck may be rename a title of issue with this fact?

sbstnk commented 2 years ago

Just to clarify my comments from the gnome issue: the problem simply is that https://github.com/flameshot-org/flameshot/blob/master/src/utils/screengrabber.cpp#L53 does remove(0, 7) instead of using something like QUrl::toLocalFile(). To track things like this down, you can request the full dbus-monitor --session logs from the user, this makes it quite obvious what is going wrong without being able to reproduce the issue locally.

The screenshot being stored to the XDG pictures folder is something that xdg-desktop-portal-gnome does and not something flameshot could change. It is also the only component that can be responsible for deleting it if the dialog got rejected, because the URI is not getting forwarded in that case. If you think it should store the file in a different location or delete it if the user denied the requesting application (such as flameshot) access to the screenshot, please file issues against it here: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues.

borgmanJeremy commented 2 years ago

Thanks for summing it up nicely. We are going to ensure this is fixed before version 11 is released (currently in beta).

borgmanJeremy commented 2 years ago

@vanheck you can test the artifacts from #2222

vanheck commented 2 years ago

@vanheck you can test the artifacts from #2222

@borgmanJeremy I've just built and test this branch... aaand... well done, it works. Thank you! .)

borgmanJeremy commented 2 years ago

Great! I'll merge it. Thanks again for the deep dive. I often have a hard time finding these unicode bugs on my own.

xvitaly commented 2 years ago

@borgmanJeremy Do you think I should backport this PR to 0.10.2 for Fedora or just wait for the 0.11 release?

borgmanJeremy commented 2 years ago

I'm going to wait for v11. There's a couple of minor issues left but should be done by the weekend.