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

GNOME custom "flameshot gui" keybinding doesn't work with Wayland, command works from terminal, nothing in dbus-monitor output either way #3326

Open
jikamens opened this issue Sep 5, 2023 · 51 comments
Labels
Unconfirmed Bug The bug is not confirmed by anyone else. Wayland Wayland specific issues

Comments

@jikamens
Copy link

jikamens commented Sep 5, 2023

Flameshot Version

I've tried this with both the Flameshot 12.1.0 included in Debian and with Flameshot built from current git (a7e0a61)

Installation Type

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

Operating System type and version

Tried both Debian 12 + Debian 13 testing

Description

I have a custom key binding set to execute "flameshot gui".

When I run the command "flameshot gui" from the command line, it works just fine.

When I hit the custom key binding, I see from my process listing that there's a flameshot gui process running, but nothing happens.

This happens with both the flameshot that comes with Debian and the one I built myself. It happens with Debian Trixie Testing and I think also with Debian 12 Bookworm, although I can't go backwards to Bookworm to confirm.

I run dbus-monitor as instructed https://flameshot.org/docs/guide/troubleshooting/ and it doesn't show any messages being sent by Flameshot when I execute "flameshot gui" either from the command line or with the key bindings.

This is not #325 because I'm not specifying any arguments to "flameshot gui".

Steps to reproduce

No response

Screenshots or screen recordings

No response

System Information

Debian Trixie Testing amd_64 GNOME Wayland. Dual monitors via DisplayLink.

@jikamens jikamens added the Unconfirmed Bug The bug is not confirmed by anyone else. label Sep 5, 2023
@jikamens jikamens changed the title GNOME custom "flameshot gui" keybinding doesn't work, command works from terminal, nothing in dbus-monitor output either way GNOME custom "flameshot gui" keybinding doesn't work with Wayland, command works from terminal, nothing in dbus-monitor output either way Sep 5, 2023
@jikamens
Copy link
Author

jikamens commented Sep 5, 2023

Tested after changing monitor scaling from 125% to 100%: didn't make a difference.

Tested with my built-in laptop screen with no DisplayLink: didn't make a difference.

Tested with Xorg instead of Wayland: WORKS FINE.

@jikamens
Copy link
Author

jikamens commented Sep 5, 2023

OK, so it's weirder than this.

If I log into Wayland, and I have Flameshot configured to launch on startup, then that flameshot can't take screenshots either, i.e., when I click on the icon and select "Take Screenshot" nothing happens. But if I kill that flameshot and restart it by running it from the terminal, then THAT flameshot can take screenshots.

So the common factor between the two is flameshot launched from inside my login session by me works, flameshot launched in the background, on startup or from a key binding, doesn't.

I've captured wrapped flameshot in a script to capture what environment variables are set in each case and tried to eliminate the differences to see if that would make a difference, but I was unable to identify any environment variables that are relevant.

Bizarre.

@username0136
Copy link

I had to change to XORG
to workaround this

it's real pain

I've tried the following
keybinding
-> doesn't work

ALT+F2 prompt to trigger it
flameshot gui
-> doesn't work

terminal command
-> works

@mmahmoudian mmahmoudian added the Wayland Wayland specific issues label Sep 9, 2023
@3vi1
Copy link

3vi1 commented Oct 2, 2023

I noticed the same thing with the keybinding not working in recent releases on X11. I ran "flameshot gui" from the console and got a segmentation fault, which explains the problem. Starting the app and clicking the tray icon still works fine.

@jikamens
Copy link
Author

jikamens commented Oct 3, 2023

I noticed the same thing with the keybinding not working in recent releases on X11. I ran "flameshot gui" from the console and got a segmentation fault, which explains the problem. Starting the app and clicking the tray icon still works fine.

This is not the same issue and you should probably open a separate ticket for it rather than commenting about it on this issue.

@johlandabee
Copy link

It does work for me on Fedora 38 and Gnome 44. Curiously, the tray menu option "Take Screenshot" does not work for me and I get an "Unable to capture screen" notification...

image

image

@multisme
Copy link

multisme commented Oct 5, 2023

Hi,
I have the same problem on my archlinux. I have tested with the DBus as indicated and got this:

dbus-monitor --session sender=org.flameshot.Flameshot
signal time=1696522089.344296 sender=org.freedesktop.DBus -> destination=:1.1140 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.1140"
signal time=1696522089.344331 sender=org.freedesktop.DBus -> destination=:1.1140 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.1140"
method call time=1696522119.590394 sender=:1.1142 -> destination=org.freedesktop.DBus serial=13 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=1696522119.590529 sender=:1.1142 -> destination=org.freedesktop.DBus serial=14 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameHasOwner
   string "org.a11y.Bus"
method call time=1696522119.590768 sender=:1.1142 -> 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'"
method call time=1696522119.590850 sender=:1.1142 -> destination=org.freedesktop.DBus serial=16 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.a11y.Bus"
method call time=1696522119.591081 sender=:1.1142 -> destination=org.a11y.Bus serial=17 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "ScreenReaderEnabled"
method call time=1696522119.591634 sender=:1.1142 -> destination=org.a11y.Bus serial=18 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.a11y.Status"
   string "IsEnabled"

@darkblaze69
Copy link

darkblaze69 commented Oct 6, 2023

It's stopped working since upgrading xdg-desktop-portal to 1.17.
According to discussion on x-d-p github, apparently previously it was working because of a bug in pre-1.17 which allowed to run flameshot this way and probably because of a bug in flameshot flatpak/xdg-desktop-portal#1070

AFAIU probably x-d-p fixed the bug but it's now flameshot's time to fix it's bug.

@ha1dfo
Copy link

ha1dfo commented Oct 6, 2023

Likely relevant lines in syslog:

2023-10-06T13:17:32.816700-07:00 matz xdg-desktop-por[3231]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
2023-10-06T13:17:32.823643-07:00 matz flameshot[172014]: flameshot: error: Unable to capture screen
2023-10-06T13:17:32.827157-07:00 matz flameshot[172014]: flameshot: error: Unable to capture screen
2023-10-06T13:17:32.828006-07:00 matz dbus-daemon[2451]: [session uid=1000 pid=2451] Activating via systemd: service name='org.freedesktop.Tracker3.Miner.Extract' unit='tracker-extract-3.service' requested by ':1.88' (uid=1000 pid=3250 comm="/usr/libexec/tracker-miner-fs-3")
2023-10-06T13:17:32.853925-07:00 matz systemd[2407]: Starting tracker-extract-3.service - Tracker metadata extractor...
2023-10-06T13:17:32.865351-07:00 matz flameshot[172014]: flameshot: info: Screenshot aborted.
2023-10-06T13:17:32.896398-07:00 matz dbus-daemon[2451]: [session uid=1000 pid=2451] Successfully activated service 'org.freedesktop.Tracker3.Miner.Extract'
2023-10-06T13:17:32.896596-07:00 matz systemd[2407]: Started tracker-extract-3.service - Tracker metadata extractor.

@dwoodwar03
Copy link

I also appear to have the same issue.
This occurs with both an upgrade from Ubuntu 23.04 to 23.10 and also a fresh install of Ubuntu 23.10 too.

The work around I found was to make a copy of the org.flameshot.Flameshot.desktop file in ~/.local/shared/applications, and set the Exec in [Desktop Entry] as
Exec=xterm -iconic -e flameshot gui --delay 500

after installing xterm.

This allows me a single click on the app icon to create screenshots without error.

@sliddjur
Copy link

Same here;
I have Ubuntu 23.10 fresh installed.
Flameshot from apt Installed: 12.1.0-2

Logs:

If I press "take screenshot" from the flameshot menu.

2023-10-15T22:12:29.800424+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: flameshot: error: Unable to capture screen
2023-10-15T22:12:39.141604+02:00 olof-hp xdg-desktop-por[2676]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
2023-10-15T22:12:39.159940+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: flameshot: error: Unable to capture screen

And if I "open launcher" from the menu

2023-10-15T22:14:20.243663+02:00 olof-hp xdg-desktop-por[2676]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
2023-10-15T22:14:20.254265+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: flameshot: error: Unable to capture screen
2023-10-15T22:14:20.254369+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: QPixmap::scaled: Pixmap is a null pixmap
2023-10-15T22:14:20.256524+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: QPixmap::scaled: Pixmap is a null pixmap
2023-10-15T22:14:20.266799+02:00 olof-hp gnome-shell[2424]: Window manager warning: Invalid WM_TRANSIENT_FOR window 0x800008 specified for 0x800011.
2023-10-15T22:14:20.306161+02:00 olof-hp gnome-shell[2424]: Meta.Rectangle is deprecated, use Mtk.Rectangle instead
2023-10-15T22:14:27.912773+02:00 olof-hp gnome-shell[2424]: message repeated 101 times: [ Meta.Rectangle is deprecated, use Mtk.Rectangle instead]
2023-10-15T22:14:29.309784+02:00 olof-hp xdg-desktop-por[2676]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
2023-10-15T22:14:29.326905+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: flameshot: error: Unable to capture screen
2023-10-15T22:14:29.408036+02:00 olof-hp org.flameshot.Flameshot.desktop[6057]: flameshot: error: Unable to capture screen
2023-10-15T22:14:29.435635+02:00 olof-hp gnome-shell[2424]: Window manager warning: Invalid WM_TRANSIENT_FOR window 0x800008 specified for 0x800011.
2023-10-15T22:14:29.460419+02:00 olof-hp gnome-shell[2424]: Meta.Rectangle is deprecated, use Mtk.Rectangle instead

@devaux
Copy link

devaux commented Oct 16, 2023

Same here on Ubuntu 23.10. Works only if i start flameshot gui in a gnome-terminal.

Tests:
Start "flameshot gui" with Alt+F2 => unable to capture screen
Start "flameshot gui" in gnome-terminal or kgx => everything works like expected
Start "flameshot" in "App menue" (Meta-key) => can't create screenshot with the icon in the top bar
Start "flameshot" in gnome-terminal or kgx => everything works like expected

Gnome 45 on Wayland.

@VladyslavParashchenko
Copy link

I have the same troubles with Manjaro and Gnome 44.5

@ttys3
Copy link

ttys3 commented Oct 19, 2023

I have the same troubles with Fedora 39 and Gnome 45

systemd[42073]: Started app-gnome-flameshot-885317.scope - Application launched by gsd-media-keys.
xdg-desktop-por[584367]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
flameshot[885317]: flameshot: error: Unable to capture screen
flameshot[885317]: flameshot: error: Unable to capture screen
flameshot[885317]: flameshot: info: Screenshot aborted.

same problem flatpak/xdg-desktop-portal#1070

I got the workaround now:

flatpak/xdg-desktop-portal#1070 (comment)

@Valeryan24
Copy link

Hi, same problem here on Ubuntu 23.10, Gnome 45, Wayland and Flameshot 12.1.0 : the program automatically starts with computer session - if I try to launch it from the top menu, nothing happens.

If I close it and re-lauch from terminal, it works - like other said. But in my case, sometimes, when I run the "Screenshot" row, screen freezes - mouse is not visible anymore, nothing works with Alt + Tab, and I have to manually reset…

@dwoodwar03
Copy link

Same here on Ubuntu 23.10. Works only if i start flameshot gui in a gnome-terminal.

Tests: Start "flameshot gui" with Alt+F2 => unable to capture screen Start "flameshot gui" in gnome-terminal or kgx => everything works like expected Start "flameshot" in "App menue" (Meta-key) => can't create screenshot with the icon in the top bar Start "flameshot" in gnome-terminal or kgx => everything works like expected

Gnome 45 on Wayland.

I found that Using Alt F2 I can run:
sh -c -- "flameshot gui"
And it works.

Also Alt F2 I can run:
sh -c -- flameshot
And it adds a usuable icon in the system tray.

@ha1dfo
Copy link

ha1dfo commented Oct 31, 2023

@dwoodwar03 I can confirm this.
It even works with the hotkeys!

2023-10-31_15-24

@ttys3
Copy link

ttys3 commented Nov 1, 2023

Same here on Ubuntu 23.10. Works only if i start flameshot gui in a gnome-terminal.
Tests: Start "flameshot gui" with Alt+F2 => unable to capture screen Start "flameshot gui" in gnome-terminal or kgx => everything works like expected Start "flameshot" in "App menue" (Meta-key) => can't create screenshot with the icon in the top bar Start "flameshot" in gnome-terminal or kgx => everything works like expected
Gnome 45 on Wayland.

I found that Using Alt F2 I can run: sh -c -- "flameshot gui" And it works.

Also Alt F2 I can run: sh -c -- flameshot And it adds a usuable icon in the system tray.

this will not work. I tried under Wayland.

bash -c -- "flameshot gui"

result in the same error:

Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
flameshot: error: Unable to capture screen
flameshot: info: Screenshot aborted.

but this will work:

flatpak/xdg-desktop-portal#1070 (comment)

sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot gui

EOF

sudo chmod a+x /usr/local/bin/flameshot-gui-workaround

make call to the wrapper /usr/local/bin/flameshot-gui-workaround

@sliddjur
Copy link

sliddjur commented Nov 1, 2023

but this will work:

flatpak/xdg-desktop-portal#1070 (comment)

sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot gui

EOF

sudo chmod a+x /usr/local/bin/flameshot-gui-workaround

make call to the wrapper /usr/local/bin/flameshot-gui-workaround

Can confirm above worked on Wayland, Gnome and Ubuntu 23.10 ☝️

sudo tee /usr/local/bin/flameshot-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot

EOF

sudo chmod a+x /usr/local/bin/flameshot-workaround

This also launches a working flameshot to the gnome tray at login.
image

@jrom99
Copy link

jrom99 commented Nov 1, 2023

I found that Using Alt F2 I can run: sh -c -- "flameshot gui" And it works.
Also Alt F2 I can run: sh -c -- flameshot And it adds a usuable icon in the system tray.

this will not work. I tried under Wayland.

bash -c -- "flameshot gui"

sh -c -- "flameshot gui" works normally here, both in a custom shortcut as well as in "Alt+F2", but bash ... doesn't. Did you try with sh or other shell (zsh, etc)?

@ttys3
Copy link

ttys3 commented Nov 2, 2023

@jrom99 no. non of the shell works.

bash, sh, zsh

Wayland user.

@kamil-karkus
Copy link

kamil-karkus commented Nov 2, 2023

wayland user (ubuntu 23.10),

sh works
zsh,bash not

@ttys3
Copy link

ttys3 commented Nov 2, 2023

sh -c -- "flameshot gui"

sh is just an symlink.

for Fedora, it is actually linked to bash

❯ ls -l `which sh`                                                                                                           
lrwxrwxrwx root root 4 B Wed Jul 19 00:00:00 2023  /usr/bin/sh ⇒ bash

For Ubuntu users, it is linked to dash, not bash

@jrom99
Copy link

jrom99 commented Nov 2, 2023

sh -c -- "flameshot gui"

sh is just an symlink.

for Fedora, it is actually linked to bash

❯ ls -l `which sh`                                                                                                           
lrwxrwxrwx root root 4 B Wed Jul 19 00:00:00 2023  /usr/bin/sh ⇒ bash

For Ubuntu users, it is linked to dash, not bash

It doesn't matter that it's a symlink, since the problem seems to be how, in Wayland, Flameshot is refused screen access since its ID doesn't match its .desktop file. I think using a file/command/alias helps because it doesn't need a .desktop file (or Flameshot is launched with another name from them).

@martin-schell
Copy link

Hello everyone, I had the same issue.

System information:

  • Ubuntu 23.10
  • Gnome 45
  • Linux 6.5.0.13

If I entered flameshot gui in the terminal, I was able to take a screenshot with Flameshot.
If I entered the Print key as shortcut for flameshot gui, the following error messages occured in the journal

xdg-desktop-por[3852]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
flameshot[32110]: flameshot: error: Unable to capture screen

To fix the issue, I created the following script and set the Print key as the shortcut for /path/to/script/run_flameshot.sh.

#!/usr/bin/env bash                                                             
flameshot gui

If I type Print, the script will run and I can take a screenshot with Flameshot.

Disabling Wayland in /etc/gdm3/custom.conf also worked for me, too. However, after disabling Wayland, I could no longer copy screenshots in Emacs (it uses wl_clipboard). So this was not a workaround for me.

I am happy to use Flameshot and thank the Flameshot team for this great application.

@vanheck
Copy link

vanheck commented Nov 28, 2023

#3326 (comment)

@jrom99 no. non of the shell works.

bash, sh, zsh

Wayland user.

no shell works for me either - Fedora 39, Gnome 45.1 (wayland)

Linux jvh-machine 6.5.12-300.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 20 22:44:24 UTC 2023 x86_64 GNU/Linux

@nooop3
Copy link

nooop3 commented Dec 2, 2023

I found a proper way to solve this issue temporarily(maybe only need to run once):

flatpak permission-set screenshot screenshot flameshot yes

We can confirm that this issue is caused by the system screenshot permission check. So we only need to add the flameshot application to the allowed list.
The application ID of the custom shortcut is just the flameshot.
You can also run the command below to fix the take a screenshot by click the flameshot icon in the top bar:

flatpak permission-set screenshot screenshot org.flameshot.Flameshot yes

And, check the screenshot permissions by the command below:

flatpak permissions

image

---- called by the custom shortcut.

@mmahmoudian Can you help to write the actions required by the user in the application or just run these commands silently(I'm not sure if it violates the security rules)?

@darkblaze69
Copy link

@nooop3 great! This is finally the fix. By the way does clipboard works for you? The result cannot be pasted for me in wayland, I have wl-clipboard, grim in GNOME.

@nooop3
Copy link

nooop3 commented Dec 3, 2023

@nooop3 great! This is finally the fix. By the way does clipboard works for you? The result cannot be pasted for me in wayland, I have wl-clipboard, grim in GNOME.

@darkblaze69 I can paste the screenshot by clipboard. I don't install the wl-clipboard, grim in GNOME, only xclip. Even when I uninstall the xclip, the clipboard still works. I have no idea about the wl-clipboard/grim. Can you make sure you have installed the xdg-desktop-portal-gnome?

@darkblaze69
Copy link

darkblaze69 commented Dec 3, 2023

Ok, got it. I'm trying to use in Wayland-only session without Xwayland, so xclip not relevant here. Apparently clipboard on flameshot is broken also in pure Wayland.

@ttys3
Copy link

ttys3 commented Dec 3, 2023

I found a proper way to solve this issue temporarily(maybe only need to run once):

flatpak permission-set screenshot screenshot flameshot yes

confirmed, this works.

before:

❯ flatpak permissions
Table             Object              App                         Permissions Data
desktop-used-apps image/jpeg          org.telegram.desktop        qimgv,1,3   0x00
gnome             shortcuts-inhibitor org.remmina.Remmina.desktop GRANTED     0x00
gnome             shortcuts-inhibitor remote-viewer.desktop       GRANTED     0x00
screenshot        screenshot                                      yes         0x00
screenshot        screenshot          kitty                       yes         0x00
screenshot        screenshot          org.flameshot.Flameshot     yes         0x00

after:

❯ flatpak permissions
Table             Object              App                         Permissions Data
desktop-used-apps image/jpeg          org.telegram.desktop        qimgv,1,3   0x00
gnome             shortcuts-inhibitor org.remmina.Remmina.desktop GRANTED     0x00
gnome             shortcuts-inhibitor remote-viewer.desktop       GRANTED     0x00
screenshot        screenshot                                      yes         0x00
screenshot        screenshot          flameshot                   yes         0x00
screenshot        screenshot          kitty                       yes         0x00
screenshot        screenshot          org.flameshot.Flameshot     yes         0x00

@jikamens
Copy link
Author

jikamens commented Dec 3, 2023

I'm using flameshot from a deb, not from a flatpak. I don't think I'm using any flatpaks, and I don't even have the flatpak executable installed. I'm assuming that the fix above will only work for people who are using flameshot from a flatpak. Is that correct?

@raygan
Copy link

raygan commented Dec 3, 2023

I found a proper way to solve this issue temporarily(maybe only need to run once):

flatpak permission-set screenshot screenshot flameshot yes

Confirmed this works for me on Fedora 39. Now I just need to find a fix for the issue with fractional scaling and I'll be golden.

@nooop3
Copy link

nooop3 commented Dec 4, 2023

I'm using flameshot from a deb, not from a flatpak. I don't think I'm using any flatpaks, and I don't even have the flatpak executable installed. I'm assuming that the fix above will only work for people who are using flameshot from a flatpak. Is that correct?

I'm also not using any fatpaks, and I installed the flameshot by the pacman command. I just found the gnome permissions can be checked by the flatpak command, I will check the flatpak command from which package when I get home(the Linux environment)

Edited:
the command flatpak is from the package flatpak, which is required by the package malcontent (application permission control). And the malcontent is the optional dependency of the package(gnome-control-center).

When I uninstalled the malcontent, and only installed the flatpak also works.

@ttys3
Copy link

ttys3 commented Dec 4, 2023

I'm using flameshot from a deb, not from a flatpak. I don't think I'm using any flatpaks, and I don't even have the flatpak executable installed. I'm assuming that the fix above will only work for people who are using flameshot from a flatpak. Is that correct?

no, it does not related to if you are using flatpak version or not.

I only use native apps, so, any way, the trick works for native program flameshot.

@nooop3
Copy link

nooop3 commented Dec 4, 2023

@jikamens Can you try these low-level dbus commands:

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

@jikamens
Copy link
Author

jikamens commented Dec 4, 2023

$ dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'Flameshot' array:string:'yes'
$ dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'
   array [
      dict entry(
                  array [
            yes         ]
      )
      dict entry(
         Flameshot         array [
            yes         ]
      )
   ]
   variant       byte 0
$ 

@jikamens
Copy link
Author

jikamens commented Dec 4, 2023

Even after executing the commands above, my custom "flameshot gui" key binding still says "Unable to capture screenshot". This is true even after issuing the commands above and logging out and logging back in.

@nooop3
Copy link

nooop3 commented Dec 4, 2023

Even after executing the commands above, my custom "flameshot gui" key binding still says "Unable to capture screenshot". This is true even after issuing the commands above and logging out and logging back in.

Try the lowercase flameshot, I have updated the command.

@jikamens
Copy link
Author

jikamens commented Dec 4, 2023

Works! Thanks.

@romanimm
Copy link

romanimm commented Dec 4, 2023

can confirm, this works
archlinux / Gnome 45.1

@christianalcantara
Copy link

but this will work:
flatpak/xdg-desktop-portal#1070 (comment)

sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot gui

EOF

sudo chmod a+x /usr/local/bin/flameshot-gui-workaround

make call to the wrapper /usr/local/bin/flameshot-gui-workaround

Can confirm above worked on Wayland, Gnome and Ubuntu 23.10 ☝️

sudo tee /usr/local/bin/flameshot-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot

EOF

sudo chmod a+x /usr/local/bin/flameshot-workaround

This also launches a working flameshot to the gnome tray at login. image

Fedora 39: Resolved 🤟

@devaux
Copy link

devaux commented Dec 14, 2023

but this will work:

flatpak/xdg-desktop-portal#1070 (comment)

sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot gui

EOF

sudo chmod a+x /usr/local/bin/flameshot-gui-workaround

make call to the wrapper /usr/local/bin/flameshot-gui-workaround

Works in Ubuntu 23.10 (Wayland) with Flameshot .deb.
Thanks a lot!

@ilyazub
Copy link

ilyazub commented Jan 17, 2024

@jikamens Can you try these low-level dbus commands:

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

That worked for me on Fedora 39. Thank you, @nooop3!

@VivaSteffan
Copy link

@jikamens Can you try these low-level dbus commands:

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

This one worked for me!

@Valeryan24
Copy link

but this will work:

Hi, thanks for your help, but I surely miss something. I don't use Flatpak, but the regular flameshot deb package on Ubuntu 24.04 and Wayland.

If I try to enter in terminal, either :

"sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot gui

EOF"

or "sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'"
then "> #!/bin/bash
flameshot gui

EOF"

I get the error message "tee: /usr/local/bin/flameshot-gui-workaround: Aucun fichier ou dossier de ce nom (no file nor folder with this name"

What should I type exactly on terminal or gedit, please ?

And then add flameshot-workaround on the startup apps ?

Can we expect soon a new release of Flameshot, which corrects this bug on Wayland ?

@p134c0d3
Copy link

p134c0d3 commented Feb 25, 2024

@jikamens Can you try these low-level dbus commands:

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

@Valeryan24 I would try this method. I'm on Arch (no flatpak) and this method worked for me. Sounds like it's working for people across various distros (Fedora, Ubuntu, etc).

@ahkdigital
Copy link

@jikamens Can you try these low-level dbus commands:

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

Chiming in that this worked for me as well on Fedora 39 Workstation (Gnome 45, Wayland).

@p134c0d3
Copy link

p134c0d3 commented Mar 6, 2024

@jikamens Can you try these low-level dbus commands:

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

This worked for me on Gnome 45 Arch! Thank you so much!!

@sliddjur
Copy link

I upgraded to Ubuntu 24.04, and I still have the same problem.

Although the same solution still works.

sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
#!/bin/bash
flameshot gui

EOF

sudo chmod a+x /usr/local/bin/flameshot-gui-workaround

@matheussouza9
Copy link

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.SetPermission string:'screenshot' boolean:true string:'screenshot' string:'flameshot' array:string:'yes'

dbus-send --session --print-reply=literal --dest=org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore.Lookup string:'screenshot' string:'screenshot'

Source

Thanks @nooop3. Also worked for me on Fedora 40, Gnome 46.1. Is this setting persisted? I mean, do we need to run this every time after the boot?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unconfirmed Bug The bug is not confirmed by anyone else. Wayland Wayland specific issues
Projects
None yet
Development

No branches or pull requests