Flameshot oddity

I am running Gnome with Wayland.

In order to make flameshot work I have

  • copied /usr/share/applications/org.flameshot.Flameshot.desktop
    • to ~/.local/share/applications/org.flameshot.Flameshot.desktop
  • and changed the exec line to
Exec=env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland /usr/bin/flameshot

flameshot starts ok but screenshot not working

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

#! /bin/sh

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

and changing the exec line in the desktop file to

Exec=/home/manfred/bin/flameshot.sh

flameshot comes up and now screenshot is working fine

Any idea why?

is .local in your path directory? only thing I can think of since I don’t use gnome or flameshot

Not sure I understand. Do you mean ~/.local as a directory in the PATH variable content? If yes then my question would be why?

I work around I found is that install flameshot and then just type

flameshot launcher in terminal and you get little GUI screen to take screenshots.

Works for me on gnome + Wayland.

When you install flameshot - I ran flameshot gui from terminal, allowed permissions and then just used it from there.

I then used a keybinding to flameshot gui into a terminal shortcut in shortcuts.

1 Like

It is really funny. All replies here do not in any way deal with the question in my post above. :grin:

It would have to do with the permissions being filled somehow.

Could you explain what you mean by permissions being filled somehow ?

It seems I found (running journalctl) an error message.

May 29 13:01:49 hogwart xdg-desktop-por[8123]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 
Only the focused app is allowed to show a system access dialog

Should add that I have installed

xdg-desktop-portal 1.16.0-3
xdg-desktop-portal-gnome 44.1-2
xdg-desktop-portal-gtk 1.14.1-1

It’s a Wayland security thing. It sounds like it found it. Someone explained it to me, but basically if you want to use it you need to grant it permissions to run within Wayland. It was over my head, I just know it worked.

1 Like

you need to grant it permissions to run within Wayland

Who is it?

My interpretation regarding permission is

  • /bin/sh does have the permission (whatever that permission is) and in the script flameshot gets the permission by inheritance
  • /bin/flameshot doesn’t have the permission

Now the interesting question is: If I am correct then what kind of permission is it?

1 or 2? My guess, it would be 2… flameshot

Or?

1 Like

I think it is 1. and 2. I am not sure. If not 1. is in effect then why does it work when flameshot is called within the /bin/sh script?

I didn’t yet find anything I could invoke to tell that flameshot should be among the good kids in town. :slight_smile:

I suspect that gnome isn’t handling Exec=env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland /usr/bin/flameshot the way you expect it to.

Exec lines in .desktops are limited in what they actually support. By putting it in a shell script you get everything that the shell can support.

I don’t really understand what permissions has to do with anything.

1 Like

At least when having the line

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

in the desktop file the flameshot has such variables set. I checked /proc/<flameshot pid>

In terms of permissions I only can imagine that there is something in dbus or wayland area where I have to tell that flameshot must be allowed.

Very interesting:
I run dbus-monitor --session sender=org.flameshot.Flameshot

When running flameshot with the explicit line in the desktop file where the screenshot doesn’t work I see

method call time=1685385145.732607 sender=:1.314 -> destination=org.freedesktop.DBus serial=29 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_314/e439ac62bf72498fb8b3c67a00fd9c88',interface='org.freedesktop.portal.Request',member='Response'"
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
      )
   ]

When the screen shot is working because I use the script I get

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'"