flameshot-org / flameshot

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

Flameshot doesn't work on Ubuntu 22.04: Use QT_QPA_PLATFORM=wayland #2199

Open Valeryan24 opened 2 years ago

Valeryan24 commented 2 years ago

Flameshot Version

Flameshot 0.10.2

Installation Type

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

Operating System type and version

Ubuntu 22.04 development

Description

Hi, thanks for this wonderful soft and all the work done. Sorry if the issue is linked to another one already opened, like #2107 :

I just upgraded to Ubuntu 22.04 development branch, and Flameshot doesn't work anymore. I well have the indicator on the top Gnome Shell panel, but trying to run a screenshot does nothing - no black window with resizing borders appears.

If I try to run from terminal, I get the error message :

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway

I don't know what it means and how to set up QT_QPA_PLATFORM=wayland. I well have gambas3-gb-qt5-wayland and qtwayland5 installed, but on the login screen I only have 3 choices : Gnome, Ubuntu Wayland or X-Org.

Other users have the same issue, and the same happens with Ksnip - so it's certainly a problem due to Wayland security restrictions, and not a bug in Flameshot : https://forum.ubuntu-fr.org/viewtopic.php?id=2068335

Steps to reproduce

Run flameshot on a Wayland session

Screenshots or screen recordings

No response

System Information

Ubuntu 22.04 on Wayland

borgmanJeremy commented 2 years ago

I was able to replicate this and then fix it. In a clean VM I saw this issues, then I installed: xdg-desktop-portal-gnome, and logged out and back in and it worked fine. This package is now required per #1910

I also installed bustle to debug any dbus issues, but i dont think this is what fixed it.

Valeryan24 commented 2 years ago

Thanks a lot, it works fine again !

It just adds a small step: when I run the screenshot, it does a capture of the entire screen, then I have to click on "Share", and it opens the normal Flameshot border selection, with all the options to save the image :)

borgmanJeremy commented 2 years ago

Yes see #1910 for why that is the case, its out of our hands. @hosiet Do you think we should make these packages required dependencies in the .deb?

mmahmoudian commented 2 years ago

We should add this to our Wayland documentation I guess if it is reproducible on a clean VM. @borgmanJeremy and @hosiet if you two agree on this, I will assigned an issue to myself to do it.

borgmanJeremy commented 2 years ago

It for sure is a requirement for gnome 41+ on wayland. The open question is if we should list it in the .deb file also.

hosiet commented 2 years ago

Please do so. Also note that xdg-desktop-portal-gnome is only for GNOME. For other Wayland-enabled desktop environment, they may need xdg-desktop-portal-gtk or xdg-desktop-portal-kde or xdg-desktop-portal-wlr for different DEs respectively.

borgmanJeremy commented 2 years ago

@hosiet is it possible to write the control file to be specific to the DE?

hosiet commented 2 years ago

I don't have opinions for upstream-provides debs. For distribution-provided packages, we already have this:

https://sources.debian.org/src/flameshot/0.10.2+ds1-4/debian/control/

Recommends:
 xdg-desktop-portal-gtk | xdg-desktop-portal-gnome | xdg-desktop-portal-kde | xdg-desktop-portal-wlr,

Probably you may also use such format; it may have advantages and disadvantages. I don't have an ideal solution.

hosiet commented 2 years ago

Just FYI: conditional-depends (install A if B has been installed) is not supported in all known dependency resolvers since that will introduce unacceptable level of complexity.

xvitaly commented 2 years ago

Added to Fedora:

Requires: xdg-desktop-portal%{?_isa}
Requires: (xdg-desktop-portal-gnome%{?_isa} if gnome-shell%{?_isa})
Requires: (xdg-desktop-portal-kde%{?_isa} if plasma-workspace%{?_isa})

Should be fixed now.

xvitaly commented 2 years ago

Just FYI: conditional-depends (install A if B has been installed) is not supported in all known dependency resolvers since that will introduce unacceptable level of complexity.

RPM supports this since version 4.13: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html

hosiet commented 2 years ago

RPM supports this since version 4.13: https://rpm-software-management.github.io/rpm/manual/boolean_dependencies.html

Thanks for the info. In Debian, the gnome-core package already has a hard dependency on xdg-desktop-portal-gnome. I am not sure if future Ubuntu (22.04 LTS) would also do the same.

wgorski commented 2 years ago

It just adds a small step: when I run the screenshot, it does a capture of the entire screen, then I have to click on "Share", and it opens the normal Flameshot border selection, with all the options to save the image :)

Same thing here. Is this the expected behaviour?

borgmanJeremy commented 2 years ago

Read the link, yes, it's gnomes decision

avramukk commented 2 years ago

I have the same problem now. image

mmahmoudian commented 2 years ago

@avramukk The problem you have is with Gnome and not Flameshot. Take your complaints to them. More information here: https://flameshot.org/docs/guide/wayland-help/#gnome

I'll hide your message as it if off-topic

Dylan-86 commented 2 years ago

I confirm that I could make it run after installing xdg-desktop-portal-gnome and rebooting.

However, each time I take a screenshot (I've set up a custom shortcut):

See below... (I couldn't take a screenshot of the screenshot app :) )

IMG_20220503_154434

borgmanJeremy commented 2 years ago

@mmahmoudian I think we should program a bot to answer that question lol.

@Dylan-86 that share button is a change gnome made upstream and we have no control over it. Sorry for the small sarcasm, I think we are averaging that question twice a day.

mmahmoudian commented 2 years ago

@Dylan-86 please read this:

https://flameshot.org/docs/guide/wayland-help/#gnome

@borgmanJeremy I'll pay 200€ for that bot if it answers that question every time and hide the question or close the issue. I bet Emacs has a package for that πŸ˜‚

Dylan-86 commented 2 years ago

@Dylan-86 please read this:

https://flameshot.org/docs/guide/wayland-help/#gnome

@borgmanJeremy I'll pay 200€ for that bot if it answers that question every time and hide the question or close the issue. I bet Emacs has a package for that πŸ˜‚

Thanks!! And sorry for the complain, I got it was a gnome thing but thought that there was a workaround :(

Thanks!

borgmanJeremy commented 2 years ago

I've been using gnome on xorg as a workaround but mainly use kde

shun1249844726 commented 2 years ago

Same problem

Asgoret commented 1 year ago

Same here. xdg-desktop-portal-gnome doesn't help

UPD#1: Reinstall doesn't help

lgrn commented 5 months ago
╰─ flameshot --version
Flameshot v12.1.0 (-)
Compiled with Qt 5.15.10
╰─ cat /etc/lsb-release
DISTRIB_ID="ManjaroLinux"
DISTRIB_RELEASE="24.0.1"
DISTRIB_CODENAME="Wynsdey"
DISTRIB_DESCRIPTION="Manjaro Linux"
╰─ sudo pacman -Q xdg-desktop-portal-gnome
xdg-desktop-portal-gnome 46.2-1
╰─ echo $XDG_SESSION_TYPE
wayland

Unfortunately, I still got:

╰─ flameshot
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

After googling a bit and finding this, I realized that if I run flameshot gui it works fine, so just putting that here in case anyone else ends up here from googling.