flameshot-org / flameshot

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

Fedora 39 screenshot capture failed #3340

Open m1xmstr opened 10 months ago

m1xmstr commented 10 months ago

Flameshot Version

12.1.0

Installation Type

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

Operating System type and version

Fedora 39 Gnome

Description

Installation works fine, open launcher works fine but when you try to capture you get "Unable to capture screen"

Steps to reproduce

No response

Screenshots or screen recordings

Hmmm funny that won't work :P

System Information

Fedora 39 Was working fine on Fedora 38

brianquirion commented 10 months ago

I have the same exact behavior after upgrading to Fedora 39 (Gnome 45). It was working fine right before upgrading.

brianquirion commented 10 months ago

In the terminal, executing flameshot gui works fine, but calling it from a custom Gnome shortcut, I see a permission error.

Sep 26 17:14:17 brian-fedora xdg-desktop-por[16068]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
Sep 26 17:14:17 brian-fedora flameshot[82450]: flameshot: error: Unable to capture screen
Sep 26 17:14:17 brian-fedora flameshot[82450]: flameshot: error: Unable to capture screen
Sep 26 17:14:17 brian-fedora flameshot[82450]: flameshot: info: Screenshot aborted.

image

dmitry-j-mikhin commented 10 months ago

Can confirm

https://github.com/flameshot-org/flameshot/assets/41896087/76495630-897c-4288-a180-486dbbfa54c1

dmitry-j-mikhin commented 10 months ago

@brianquirion I found a strange workaround to this problem. If Flameshot is executed under strace, everything works well. It's not pretty, but it's better than nothing)

https://github.com/flameshot-org/flameshot/assets/41896087/dc201e0d-5e26-4d00-99c1-06c3be3e5ac0

mmahmoudian commented 10 months ago

@m1xmstr @brianquirion @dmitry-j-mikhin I assume you are are on Wayland? Can you all confirm that?

dmitry-j-mikhin commented 10 months ago

@mmahmoudian yes, I'm on Wayland

m1xmstr commented 10 months ago

Wayland as well...

mmahmoudian commented 10 months ago

Thanks. Lets see what Gnome broke this time around 🙄

openscript commented 9 months ago

Probably related to https://github.com/flameshot-org/flameshot/issues/3326

dmitry-j-mikhin commented 9 months ago

Probably related to #3326

Yep. Looks like the same.

darkblaze69 commented 9 months ago

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 https://github.com/flatpak/xdg-desktop-portal/issues/1070

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

Borok93 commented 9 months ago

Same for me under Wayland on Fedora 38 - "Unable to capture screen"

davletsh1n commented 8 months ago

Reported: https://bugzilla.redhat.com/show_bug.cgi?id=2248667

staticf0x commented 8 months ago

From the linked xdg-desktop-portal issue, the workaround is here: https://github.com/flatpak/xdg-desktop-portal/issues/1070#issuecomment-1771302632

Giving flameshot QT_QPA_PLATFORM=wayland env variable works for me.

azzamsa commented 8 months ago

Giving flameshot QT_QPA_PLATFORM=wayland env variable works for me.

I updated every exec line in /usr/share/applications/org.flameshot.Flameshot.desktop to:

- Exec=flameshot
+ Exec=env QT_QPA_PLATFORM=wayland flameshot

- Exec=flameshot config
+ Exec=env QT_QPA_PLATFORM=wayland flameshot config

- Exec=flameshot gui --delay 500
+ Exec=env QT_QPA_PLATFORM=wayland flameshot gui --delay 500

- Exec=flameshot launcher
+ Exec=env QT_QPA_PLATFORM=wayland flameshot launcher

Nothing worked, but it does when I run from the terminal.

d-pletikapa commented 8 months ago

Same problem, so right now we go on x11 session and waiting for fix for wayland?

staticf0x commented 8 months ago

Same problem, so right now we go on x11 session and waiting for fix for wayland?

You can try the workaround with setting QT_QPA_PLATFORM=wayland, that worked for me on wayland.

skewty commented 8 months ago

Perhaps Flameshot hasn't yet been updated to use: https://github.com/flatpak/xdg-desktop-portal/commit/c8274173f7d127f1d7e39e8b5bcaf7f0ee751f48

dustech commented 8 months ago

Can confirm. Fedora 39 here, the gnome shortcut doesn't work anymore. It was fine under Fedora 38. If I run flameshot gui from the terminal, that's working.

sanjayguwaju commented 7 months ago

flameshot gui in fedora 39 works fine for me.

kleinpetr commented 7 months ago

I've upgraded to Fedora 39 and I am facing the same issue. the flameshot gui works well when I run it under the Terminal but not from the keyboard shortcut. Wayland of course

azzamsa commented 7 months ago

I've upgraded to Fedora 39 and I am facing the same issue. the flameshot gui works well when I run it under the Terminal but not from the keyboard shortcut. Wayland of course

Yes, same here. Now I use gnome-screenshot alongside flamshot. I run flameshot occasionally from the terminal when I need to add annotations and arrows, it is faster than gnome-screenshot + maoschanz/drawing.

In my case, Flameshot can only run from the Terminal, it doesn't work from the GUI menu app.

sebw commented 7 months ago

On wayland. Same as above, from CLI it works but gnome shortcut doesn't.

Aztek1337 commented 7 months ago

I have the same issue.

My keyboard shortcut stopped working but launching from terminal works fine.

I made a workaround that works just fine.

I made a shell script called flameshot-workaround.sh

#!/bin/bash
flameshot gui

make it executable with chmod +x

made a bin file in /bin called flameshot-workaround the bin file contains the path to the script;

#!/bin/bash

~/scripts/sh_utils/flameshot-workaround.sh

Replaced Gnome shortcut to call the new flameshot-workaround bin,

This should help everyone for a while as the team fixes the issue.

Thank you FlameShot Devs!

nix155 commented 6 months ago

Write a script named flameshot.sh, give it execute permissions, and place it in /usr/local/bin:

#!/bin/bash

if [ $# -eq 0 ]; then
    flameshot gui
elif [ "$1" == "config" ]; then
    flameshot config
elif [ "$1" == "gui" ]; then
    flameshot gui --delay 500
elif [ "$1" == "launcher" ]; then
    flameshot launcher
else
    echo "Unsupported argument"
    exit 1
fi

Modify org.flameshot.Flameshot.desktop:

Exec=flameshot.sh
Exec=flameshot.sh gui
Exec=flameshot.sh config
dangoncalves commented 6 months ago

Hello,

Running these commands resolve the bug: 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:'org.flameshot.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'

DerpDerpingtonIsHere commented 5 months ago

Hello,

Running these commands resolve the bug: 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:'org.flameshot.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'

This worked for me perfectly!

xegulon commented 5 months ago

In my case, flameshot works from the terminal, I have a Gnome popup asking for authorizing flameshot to take screenshots permanently, but I have an error when I trigger flameshot gui from a keyboard shortcut

Thanks @Aztek1337 for your workaround

nix155 commented 5 months ago

When I executed these two 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:'org.flameshot.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'

the launch of Flameshot from the shortcut started working properly, but when I added a keyboard shortcut (Ctrl + PrntScr) for flameshot gui, I get "Unable to capture Screen". Through the script (as I wrote earlier) the keyboard shortcut works fine.

maxisusi commented 4 months ago

I have the same issue.

My keyboard shortcut stopped working but launching from terminal works fine.

I made a workaround that works just fine.

I made a shell script called flameshot-workaround.sh

#!/bin/bash
flameshot gui

make it executable with chmod +x

made a bin file in /bin called flameshot-workaround the bin file contains the path to the script;

#!/bin/bash

~/scripts/sh_utils/flameshot-workaround.sh

Replaced Gnome shortcut to call the new flameshot-workaround bin,

This should help everyone for a while as the team fixes the issue.

Thank you FlameShot Devs!

Worked for me, thank you!

Crazy this issue is still not resolved...

skewty commented 4 months ago

Gnome 46 is now in BETA and we don't seem to be any closer to a merged solution.

The shell script workaround of:

#!/bin/bash
flameshot gui

is a poor work around in my opinion. Are the following d-bus alterations cross platform / worth baking into the extension:

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:'org.flameshot.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'

or is it a workaround as well?

Is there a "proper" way to fix this not being discussed? If the d-bus commands are the best way, perhaps someone (or myself) can prepare a merge request.

SirRFI commented 2 months ago

Same here. Upgrading from Fedora 38 to 39 (GNOME, Wayland) broke flameshot gui (native version from Fedora repo) when ran through key bind. When doing so, a notification appears:

Flameshot Error Unable to capture screen

Flameshot works when ran through terminal.

Did clean install of Fedora 40 (GNOME, Wayland) and the issue still persists. Someone told me it works on X11.

$ flameshot -v
Flameshot v12.1.0 (-)
Compiled with Qt 5.15.12

Creating a shell script workaround works, but obviously it's less than ideal.