flameshot-org / flameshot

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

flameshot with Gnome 44 and wayland working only in specific setting #3213

Open manfredlotz opened 1 year ago

manfredlotz commented 1 year ago

Flameshot Version

This is EndeavourOS with Gnome 44 and Wayland. flameshot is 12.1.0-1

Flameshot v12.1.0 (-) Compiled with Qt 5.15.5 linux: 6.3.4-zen1-1-zen endeavouros: unknown

Installation Type

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

Operating System type and version

Linux, 6.3.4-zen

Description

As I was unable to get a screenshot with flameshot I copied /usr/share/applications/org.flameshot.Flameshot.desktop to ~/.local/share/applications/org.flameshot.Flameshot.desktop

Then I changed the exec line to

Exec=env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland /usr/bin/flameshot

flameshot starts ok but screenshot not working

I ran dbus-monitor --session sender=org.flameshot.Flameshot and got

method call time=1685385145.732791 sender=:1.314 -> destination=org.freedesktop.portal.Desktop serial=30 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "e439ac62bf72498fb8b3c67a00fd9c88"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]

But when I create a script ~/bin/flameshot.sh containing

#! /bin/sh

env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland /usr/bin/flameshot

then flameshot starts ok and screenshot is working fine

Here the dbus-monitor shows

method call time=1685385248.149252 sender=:1.354 -> destination=org.freedesktop.DBus serial=31 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=1685385248.149292 sender=:1.354 -> destination=org.freedesktop.DBus serial=32 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1685385248.149642 sender=:1.354 -> destination=org.freedesktop.DBus serial=33 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1685385248.149939 sender=:1.354 -> destination=org.freedesktop.DBus serial=34 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_354/0617ee6d667a4d04afbeb06e5c7962cd',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1685385248.149957 sender=:1.354 -> destination=org.freedesktop.DBus serial=35 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=1685385248.149966 sender=:1.354 -> destination=org.freedesktop.DBus serial=36 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1685385248.150206 sender=:1.354 -> destination=org.freedesktop.portal.Desktop serial=37 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "0617ee6d667a4d04afbeb06e5c7962cd"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
method call time=1685385248.695167 sender=:1.354 -> destination=org.freedesktop.portal.Desktop serial=38 path=/org/freedesktop/portal/desktop/request/1_354/0617ee6d667a4d04afbeb06e5c7962cd; interface=org.freedesktop.portal.Request; member=Close
method call time=1685385248.696921 sender=:1.354 -> destination=org.freedesktop.DBus serial=39 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_354/0617ee6d667a4d04afbeb06e5c7962cd',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1685385248.696945 sender=:1.354 -> destination=org.freedesktop.DBus serial=40 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=1685385248.696954 sender=:1.354 -> destination=org.freedesktop.DBus serial=41 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=1685385252.688376 sender=:1.354 -> destination=org.freedesktop.Notifications serial=42 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1685385252.689504 sender=:1.354 -> destination=org.freedesktop.DBus serial=43 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=1685385252.689563 sender=:1.354 -> destination=org.freedesktop.DBus serial=44 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1685385252.690196 sender=:1.354 -> destination=org.freedesktop.Notifications serial=45 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Flameshot Info"
   string "Capture saved to clipboard."
   array [
   ]
   array [
   ]
   int32 5000
method call time=1685385252.699636 sender=:1.354 -> destination=org.freedesktop.DBus serial=46 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'"

I have no idea if this is a flameshot specific error or if there is some kind of permission which flameshot lacks when called directly

Steps to reproduce

see above in the description

Screenshots or screen recordings

No response

System Information

System:
  Host: hogwart Kernel: 6.3.4-zen1-1-zen arch: x86_64 bits: 64 Desktop: GNOME
    v: 44.1 Distro: EndeavourOS
Graphics:
  Device-1: NVIDIA TU116M [GeForce GTX 1650 Ti Mobile] driver: nvidia
    v: 530.41.03
  Device-2: AMD Renoir driver: amdgpu v: kernel
  Device-3: Chicony HD Webcam driver: uvcvideo type: USB
  Display: wayland server: X.org v: 1.21.1.8 with: Xwayland v: 23.1.1
    compositor: gnome-shell v: 44.1 driver: X: loaded: amdgpu,nvidia
    unloaded: modesetting,radeon dri: radeonsi gpu: nvidia,amdgpu
    resolution: 1920x1080
  API: OpenGL v: 4.6 Mesa 23.1.1 renderer: AMD Radeon Graphics (renoir LLVM
    15.0.7 DRM 3.52 6.3.4-zen1-1-zen)
jack9603301 commented 1 year ago

@manfredlotz Probably GNOME's security restrictions! If you use wayland, in addition to using GNOME you can also learn about hyprland-like

manfredlotz commented 1 year ago

I know about these security restrictions. I only don't understand why I have to open flameshot configuration window in order to be able to see the security pop-up window.

manfredlotz commented 1 year ago

Now, when I re-install flameshot 12.1.0-1 arch package things are still working fine.

So, the whole issue was not seeing the security popup window.

jack9603301 commented 1 year ago

@manfredlotz Let me summarize:

When you use the current official mainline flameshot, it can't take screenshots from any way (including the command line), when you go through my branch, it can take screenshots normally, but in either version, you have to open the flameshot settings once in order to allow screenshots when using the icon in gnome's launcher

manfredlotz commented 1 year ago

Now when coming back to official flameshot it was not required to allow screenshots as this was done already.

So, when having allowed screenshots then

No, need to re-allow.

jack9603301 commented 1 year ago

@manfredlotz .... Okay! It's an oops!

jack9603301 commented 1 year ago

@manfredlotz Official branch, command line screenshot works fine with my branch disabled?

manfredlotz commented 1 year ago

At least the official Arch package works fine. I also could clone the official repos and build.

jack9603301 commented 1 year ago

Well, then it seems to be an oops, I had thought that dbus direct communication didn't seem to work in your environment

@mmahmoudian Now, a community decision is needed on whether the gnome adapter should be added

mmahmoudian commented 1 year ago

@jack9603301 we are short in developers, and getting new developers and contributors is the main priority at the moment. There are lots of PRs that should be reviewed and merged and some high priority bugs

jack9603301 commented 1 year ago

@mmahmoudian Yes, I agree, it takes a sustained community effort, the perfect open source product is not done by one person, it has to be driven by the community - the big difference with the commercial product model is that commercial products are company driven, the company can hire people or hire regular members by paying them a salary to do it But the main members of the open source community are just enthusiasts - even if it temporarily finds other people or freelancers, the main developers driving the project are still just enthusiasts, relying on their personal commitment to do it for free, so we just need to do it ourselves

The community philosophy of the open source community is - no one is obligated to make guarantees for anyone indefinitely, unless you pay someone to do it for you full time or on a temporary basis as a freelancer, otherwise, if you want a feature and it's not there, either wait or implement it yourself!

jack9603301 commented 1 year ago

@mmahmoudian Maybe flameshot needs full documentation, including how to contribute, and maybe it can attract new users to come forward to contribute

mmahmoudian commented 1 year ago

@jack9603301 please you and anyone else who is willing to discuss this matter join the Matrix room "Developers" from the following Matrix Space so we can discuss the plausible ways to attract new contributors:

https://matrix.to/#/#flameshot-org:matrix.org

That channel is open 24/7 and we can give it few days to hear all opinions

I will hide these last few comments as off-topic at some point, but for the next few days they will be visible to inform all.

Thanks

manfredlotz commented 1 year ago

The security window only popping up when flameshot configuration window is open, is this a bug in flameshot or is it a bug in dbus?

jack9603301 commented 1 year ago

The security window only popping up when flameshot configuration window is open, is this a bug in flameshot or is it a bug in dbus?

It's weird, I thought at first that I couldn't take screenshots via command line and gui any way so I added an adapter, yet now you're telling me the original mainline branch screenshot program is accessible too! So what was this problem to begin with?

manfredlotz commented 1 year ago

Now in the end we recognized that the original problem was that

xdg-desktop-por[6966]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog

Only when I opened flameshot configuration dialog first and then tried to get a screenshot by clicking on the flameshot tray icon the security window asking me if I want to allow taking screenshots popped up.

Now all is working fine.

As asked above: a bug in flameshot, a bug in dbus or (just came to my mind), a bug in Gnome somewhere?

jack9603301 commented 1 year ago

@manfredlotz I think it's the gnome security restrictions! If you feel this restriction is holding you back, I think you might consider other wayland implementations like hyprland!

manfredlotz commented 1 year ago

I have no problem that Gnome asks me to allow flameshot to take screenshots as this is asked only one time.

My problem is that without the flameshot configuration window open I dont' see the security window and such don't know that Gnome wants to ask me.

jack9603301 commented 1 year ago

I have no problem that Gnome asks me to allow flameshot to take screenshots as this is asked only one time.

My problem is that without the flameshot configuration window open I dont' see the security window and such don't know that Gnome wants to ask me.

I think this might be a bug in gnome

It is not flameshot's problem

mmahmoudian commented 1 year ago

@manfredlotz As @jack9603301 kindly pointed out, that sounds like yet another Gnome issue.

manfredlotz commented 1 year ago

Yes, it could well be that this is some Gnome issue.

jack9603301 commented 1 year ago

Yes, it could well be that this is some Gnome issue.

If you wish, you should file a bug report with the GNOME project

jack9603301 commented 1 year ago

@mmahmoudian Now there is one more question

About https://github.com/flameshot-org/flameshot/pull/3215

Does it still need to be merged? It uses the gnome command line adapter

keteague commented 1 year ago

@manfredlotz Thanks for the troubleshooting.

@jack9603301 I've also had this problem for quite some time. Thank you for finding an alternate method to get this to work.

I've read through this thread implemented the same stuff that you had @manfredlotz do, with the exception of -DCMAKE_INSTALL_PREFIX=/home/ken.

When I attempt to take a screenshot after invoking ./flameshot from $HOME/ken/bin, I receive an error Unable to capture screen. Since flameshot is run from the command line and not forked to the background, I see this error:

QFile::remove: Empty or null file name
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
QLayout: Attempting to add QLayout "" to SidePanelWidget "", which already has a layout

In another terminal window, I'm monitoring dbus a la dbus-monitor --session sender=org.flameshot.Flameshot. Before launching flameshot, I see:

signal time=1687811853.250121 sender=org.freedesktop.DBus -> destination=:1.501 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.501"
signal time=1687811853.250150 sender=org.freedesktop.DBus -> destination=:1.501 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.501"

Upon initial launching of flameshot, I see:

method call time=1687812038.155358 sender=:1.509 -> destination=org.freedesktop.DBus serial=12 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=1687812038.155379 sender=:1.509 -> destination=org.freedesktop.DBus serial=13 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameHasOwner
   string "org.a11y.Bus"
method call time=1687812038.155432 sender=:1.509 -> destination=org.freedesktop.DBus serial=14 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=1687812038.155463 sender=:1.509 -> destination=org.freedesktop.DBus serial=15 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.a11y.Bus"
method call time=1687812038.155526 sender=:1.509 -> destination=org.a11y.Bus serial=16 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "ScreenReaderEnabled"
method call time=1687812038.155711 sender=:1.509 -> destination=org.a11y.Bus serial=17 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "IsEnabled"

When I take a screenshot, I hear two camera snapshot sounds and see this:

method call time=1687812065.112624 sender=:1.509 -> destination=org.freedesktop.portal.Desktop serial=18 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1687812065.113992 sender=:1.509 -> destination=org.freedesktop.DBus serial=19 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=1687812065.114011 sender=:1.509 -> destination=org.freedesktop.DBus serial=20 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1687812065.114112 sender=:1.509 -> destination=org.freedesktop.DBus serial=21 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1687812065.114186 sender=:1.509 -> destination=org.freedesktop.DBus serial=22 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_509/2def2bdd423e495b9e1d9f168197ab05',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1687812065.114194 sender=:1.509 -> 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=1687812065.114216 sender=:1.509 -> destination=org.freedesktop.DBus serial=24 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.portal.Desktop"
method call time=1687812065.114296 sender=:1.509 -> destination=org.freedesktop.portal.Desktop serial=25 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "2def2bdd423e495b9e1d9f168197ab05"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
method call time=1687812065.672334 sender=:1.509 -> destination=org.freedesktop.portal.Desktop serial=26 path=/org/freedesktop/portal/desktop/request/1_509/2def2bdd423e495b9e1d9f168197ab05; interface=org.freedesktop.portal.Request; member=Close
method call time=1687812065.672471 sender=:1.509 -> destination=org.freedesktop.Notifications serial=27 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1687812065.672968 sender=:1.509 -> destination=org.freedesktop.DBus serial=28 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=1687812065.672998 sender=:1.509 -> destination=org.freedesktop.DBus serial=29 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1687812065.673150 sender=:1.509 -> destination=org.freedesktop.Notifications serial=30 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Flameshot Error"
   string "Unable to capture screen"
   array [
   ]
   array [
   ]
   int32 5000
method call time=1687812065.681834 sender=:1.509 -> destination=org.freedesktop.DBus serial=31 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=1687812065.681972 sender=:1.509 -> destination=org.freedesktop.DBus serial=32 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_509/2def2bdd423e495b9e1d9f168197ab05',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1687812065.681987 sender=:1.509 -> destination=org.freedesktop.DBus serial=33 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=1687812065.682016 sender=:1.509 -> destination=org.freedesktop.DBus serial=34 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=1687812065.682044 sender=:1.509 -> destination=org.freedesktop.DBus serial=35 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=1687812065.682075 sender=:1.509 -> destination=org.freedesktop.DBus serial=36 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.Notifications"
method call time=1687812065.682244 sender=:1.509 -> destination=org.freedesktop.Notifications serial=37 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "flameshot"
   uint32 0
   string "flameshot"
   string "Flameshot Error"
   string "Unable to capture screen"
   array [
   ]
   array [
   ]
   int32 5000
method call time=1687812065.685904 sender=:1.509 -> 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.Notifications'"

And journalctl -n 100 -f reveals:

Jun 26 15:46:04 rokete xdg-desktop-por[73211]: Unhandled parent window type 
Jun 26 15:46:04 rokete xdg-desktop-por[73211]: Failed to associate portal window with parent window ''
Jun 26 15:46:04 rokete rclone[3665]: ERROR : Screenshot-25.png: WriteFileHandle.New Rcat failed: failed to create temporary local FS to spool file: stat /tmp/rclone/ken/pictures: no such file or directory
Jun 26 15:46:04 rokete rclone[3665]: ERROR : Screenshot-25.png: WriteFileHandle.Write error: io: read/write on closed pipe
Jun 26 15:46:04 rokete rclone[3665]: ERROR : IO error: io: read/write on closed pipe
Jun 26 15:46:04 rokete rclone[3665]: ERROR : Screenshot-25.png: WriteFileHandle.Write error: io: read/write on closed pipe
Jun 26 15:46:04 rokete rclone[3665]: ERROR : IO error: io: read/write on closed pipe
Jun 26 15:46:04 rokete rclone[3665]: ERROR : Screenshot-25.png: WriteFileHandle.Flush error: failed to create temporary local FS to spool file: stat /tmp/rclone/ken/pictures: no such file or directory
Jun 26 15:46:04 rokete rclone[3665]: ERROR : IO error: failed to create temporary local FS to spool file: stat /tmp/rclone/ken/pictures: no such file or directory
Jun 26 15:46:04 rokete dbus-daemon[3657]: [session uid=1000 pid=3657] Activating via systemd: service name='org.freedesktop.Tracker3.Miner.Extract' unit='tracker-extract-3.service' requested by ':1.81' (uid=1000 pid=4600 comm="/usr/libexec/tracker-miner-fs-3")
Jun 26 15:46:04 rokete systemd[3602]: Starting tracker-extract-3.service - Tracker metadata extractor...
Jun 26 15:46:04 rokete dbus-daemon[3657]: [session uid=1000 pid=3657] Successfully activated service 'org.freedesktop.Tracker3.Miner.Extract'
Jun 26 15:46:04 rokete systemd[3602]: Started tracker-extract-3.service - Tracker metadata extractor.
Jun 26 15:46:04 rokete rclone[3665]: ERROR : IO error: can't open file - writer failed
Jun 26 15:46:04 rokete tracker-extract[77468]: Task for 'file:///home/ken/Pictures/Screenshot-25.png' finished with error: Could not get any metadata for uri:'file:///home/ken/Pictures/Screenshot-25.png' and mime:'image/png'

Note that $HOME/Pictures is mounted to my OneDrive account using rclone even though my flameshot.ini is configured to save my screenshots to /home/ken/tmp.

ken@rokete:~/.config/flameshot$ cat flameshot.ini 
[General]
contrastOpacity=188
drawThickness=1
filenamePattern=Screenshot_%F_%H%M%S
savePath=/home/ken/tmp
uiColor=#e71010

I've got so far as to remove the flameshot package that's included in the Debian repo to make sure it's not being used in any way.

OS: Debian (testing)

Mikenux commented 11 months ago

Hello! Maybe this: https://github.com/flatpak/xdg-desktop-portal/issues/1070#issuecomment-1693402265?

Comment edited to show correct link.

swick commented 11 months ago

in commit 8ff94a95a8b59f3e23327b7e9b3fe91f23b885b6 the desktop and icon files were renamed. This is a mistake. The names should match the executable instead, like it did before (for flatpak, the manifest has support for file-renaming https://docs.flatpak.org/en/latest/manifests.html#file-renaming so this is not an issue).

The desktop file needs to match the executable when launched as a command for the portal to pick up the desktop file for it.

The remaining issue is that the security policy of mutter doesn't allow an app without a focused window to show a permission dialog (which makes sense, because you can't tell which app is requesting permission without a visible window). There is really something that flameshot has to fix somehow.

swick commented 11 months ago

One more thought: it would be possible to try to take a screenshot without starting the UI, if that fails, start the UI, take a screenshot again.

The first time the user tries to take a screenshot, it will fail, the UI will start, the user can then select to always allow the app to take screenshots. When the user then tries to take a screenshot again, it will work without the UI starting.

paul9115 commented 11 months ago

Not sure how much I can contribute to this since the original report was so detailed, but I can confirm I'm facing the same issues on Arch (Gnome 44.4) and Flameshot v12.1.0 (a7e0a618) Compiled with Qt 5.15.10

I also tried to create a script to launch the application which does work

#! /bin/sh

env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland /usr/bin/flameshot

and linking the Exec entry in the .desktop file to the script instead of the binary, but this still seems to launch the application without the environment variables.

fabifont commented 3 months ago

Now in the end we recognized that the original problem was that

* when trying a screenshot by clicking on the flameshot tray icon

* the security window to ask if I want to allow flameshot taking screenshots didn't appear

* and the same time there was a message in the syslog
xdg-desktop-por[6966]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog

Only when I opened flameshot configuration dialog first and then tried to get a screenshot by clicking on the flameshot tray icon the security window asking me if I want to allow taking screenshots popped up.

Now all is working fine.

As asked above: a bug in flameshot, a bug in dbus or (just came to my mind), a bug in Gnome somewhere?

Hi, I have the same problem, but the permission popup won't come up even if I open the configuration dialog before taking the screenshot. Do you know of any way to fix this?

keteague commented 3 months ago

I couldn't find a solution so I had to stop using flameshot

On Sun, May 5, 2024, 12:52 PM Fabio Fontana @.***> wrote:

Now in the end we recognized that the original problem was that

  • when trying a screenshot by clicking on the flameshot tray icon

  • the security window to ask if I want to allow flameshot taking screenshots didn't appear

  • and the same time there was a message in the syslog

xdg-desktop-por[6966]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog

Only when I opened flameshot configuration dialog first and then tried to get a screenshot by clicking on the flameshot tray icon the security window asking me if I want to allow taking screenshots popped up.

Now all is working fine.

As asked above: a bug in flameshot, a bug in dbus or (just came to my mind), a bug in Gnome somewhere?

Hi, I have the same problem, but the permission popup won't come up even if I open the configuration dialog before taking the screenshot. Do you know of any way to fix this?

— Reply to this email directly, view it on GitHub https://github.com/flameshot-org/flameshot/issues/3213#issuecomment-2094892717, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRPVMLDV5IUVTLIHNU4EF3ZAZWVZAVCNFSM6AAAAAAYTC34B2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUHA4TENZRG4 . You are receiving this because you commented.Message ID: @.***>

fabifont commented 3 months ago

I couldn't find a solution so I had to stop using flameshot On Sun, May 5, 2024, 12:52 PM Fabio Fontana @.> wrote: Now in the end we recognized that the original problem was that when trying a screenshot by clicking on the flameshot tray icon the security window to ask if I want to allow flameshot taking screenshots didn't appear and the same time there was a message in the syslog xdg-desktop-por[6966]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog Only when I opened flameshot configuration dialog first and then tried to get a screenshot by clicking on the flameshot tray icon the security window asking me if I want to allow taking screenshots popped up. Now all is working fine. As asked above: a bug in flameshot, a bug in dbus or (just came to my mind), a bug in Gnome somewhere? Hi, I have the same problem, but the permission popup won't come up even if I open the configuration dialog before taking the screenshot. Do you know of any way to fix this? — Reply to this email directly, view it on GitHub <#3213 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRPVMLDV5IUVTLIHNU4EF3ZAZWVZAVCNFSM6AAAAAAYTC34B2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUHA4TENZRG4 . You are receiving this because you commented.Message ID: **@.***>

I found a workaround. I downgraded xdg-desktop-portal to version 1.16.0 and xdg-desktop-portal-gnome to version 43.1, then I started flameshot, opened the settings panel from the tray icon and then I tried to capture a screenshot. Finally the permission popup appeared, I accepted it and now I am able to take screenshots with the classical shortcut I was using. I also re-upgraded the packages and it is still working.

aleb commented 3 months ago

It works with a workaround:

  1. notice when you run flameshot config it prints Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
  2. run QT_QPA_PLATFORM=wayland flameshot config to open the flameshot config window
  3. press Win key to display the open apps at the bottom of the screen
  4. right-click the flameshot icon and choose "Take screenshot" in the menu
  5. notice the system dialog asking for permission, allow it
  6. create a wrapper script and create a custom system keyboard shortcut so that the PrintScreen keyboard activates it:
    $ nano ~/bin/flameshot-wrapper
    #!/bin/sh
    QT_QPA_PLATFORM=wayland flameshot gui
    $ chmod u+x ~/bin/flameshot-wrapper

Maybe it works without the wrapper if you put QT_QPA_PLATFORM=wayland in your ~/.profile.. not sure what it could break.

$ pacman -Ss xdg-desktop | grep installed
extra/xdg-desktop-portal 1.18.4-1 [installed]
extra/xdg-desktop-portal-gnome 46.1-1 (gnome) [installed]
extra/xdg-desktop-portal-gtk 1.15.1-2 [installed]
m44soroush commented 2 months ago

Thanks @aleb for the solution. I have Ubuntu 24.04 with the same problem, and setting that env solved my problem.

Also if Falmeshot is installed via apt, you can change the desktop entry like this: /usr/share/applications/org.flameshot.Flameshot.desktop

Exec=env T_QPA_PLATFORM=wayland flameshot