flameshot-org / flameshot

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

Wayland does not support QWindow::requestActivate() on KDE Plasma #2436

Closed snyssen closed 2 years ago

snyssen commented 2 years ago

Flameshot Version

Flameshot v11.0.0 (-) Compiled with Qt 5.15.2 linux: 5.16.8-200.fc35.x86_64 fedora: 35

Installation Type

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

Operating System type and version

Fedora 35 with KDE Plasma 5.23.5 on Wayland

Description

The application starts without an itch, but it fails to take any screenshot afterward. Problem is similar to issue #619, and as far as I can see was fixed under Sway, but is still encountered under KDE Plasma on Wayland.

Steps to reproduce

  1. Run flameshot
  2. Click on the tray icon to take a screenshot
  3. Visually nothing happens, but on the terminal you can see the following messages:
    Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
    qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

I also tried running flameshot full, it seems to take the screenshot but fails when saving the file with the following message:

kf.kio.widgets.kdirmodel: No node found for item that was just removed: QUrl("file:///home/snyssen/Pictures/28382-gunar-streu-midwinter-morning.jpg")

(the mentioned file is the first that appear inside the folder when ordered alphabetically, and it has nothing to do with the actual screenshot) I doubt the bugs are correlated, but I wanted to include it in case it could be.

Screenshots or screen recordings

No response

System Information

Output from Neofetch:


OS: Fedora Linux 35 (KDE Plasma) x86_64 Host: XPS 15 7590 Kernel: 5.16.8-200.fc35.x86_64 Uptime: 1 hour, 6 mins Packages: 2187 (rpm), 28 (flatpak) Shell: zsh 5.8.1 Resolution: 3840x2160 DE: Plasma 5.23.5 WM: kwin Theme: Layan [Plasma], Adwaita [GTK2], Breeze [GTK3] Icons: [Plasma], Tela [GTK2/3] Terminal: konsole CPU: Intel i7-9750H (12) @ 4.500GHz GPU: NVIDIA GeForce GTX 1650 Mobile / Max-Q GPU: Intel CoffeeLake-H GT2 [UHD Graphics 630] Memory: 17899MiB / 31721MiB

borgmanJeremy commented 2 years ago

How did you install Flameshot?

mmahmoudian commented 2 years ago

Based on the answer to the form I believe both dnf and flatpak version? @snyssen please confirm/correct me.

snyssen commented 2 years ago

Hi, yes I tried them both and the result was the same. I used sudo dnf install flameshotand flatpak install flathub org.flameshot.Flameshot to install them.

greenfoo commented 2 years ago

Regarding this piece of information contained in the original comment:

...as far as I can see was fixed under Sway, but is still encountered
under KDE Plasma on Wayland

...I can confirm that it was fixed on sway, but the bug returned (same error message you get in KDE: qt.qpa.wayland: Wayland does not support QWindow::requestActivate()) a few weeks (maybe ~1 month) ago.

This is what I'm using:

sway version 1.7
Flameshot v11.0.0 (compiled with Qt 5.15.2)
fraschm1998 commented 2 years ago

I have the same problem with DWL version 0.2.2 running flameshot 11:

flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
flameshot: info: Screenshot aborted.
Keksgesicht commented 2 years ago
Operating System: Manjaro Linux
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Graphics Platform: Wayland

pacman version:

Flameshot v11.0.0 (-)
Compiled with Qt 5.15.2

flatpak version

Flameshot v11.0.0 ()
Compiled with Qt 5.15.3

for me the problem only exists with the flatpak version.

greenfoo commented 2 years ago

It looks like many other applications (OBS, LibreOffice, QtDockir, ...) are reporting a similar issue.

It also looks like Qt developers don't consider this to be a bug (see last paragraph of this comment):

>> qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

This means your window tried to grab focus in the compositor,
which is not allowed in wayland. Don't create a bug for it, there's
nothing we can do.
snyssen commented 2 years ago

This is really annoying since because of this bug Flameshot is literally unusable at the moment on Plasma Wayland :( Of course I am not blaming anyone, but I hope a solution is possible, otherwise I will simply have to find an alternative to Flameshot (for the moment I am using Spectacle, but it is nowhere near Flameshot in term of ease of use and functionalities)

borgmanJeremy commented 2 years ago

I don't use wayland on KDE so its support for it is way behind. Need some more dev's to commit to helping fix wayland specific bugs.

greenfoo commented 2 years ago

Update from my side: turns out, in my case (using sway) the problem was that I was not setting XDG_CURRENT_DESKTOP=sway from gdm (I was setting it before... but something must have broken in a recent update).

Anyway... I figured out the specific problem by running flameshot under gdb, setting a breakpoint in ScreenGrabber::grabEntireDesktop() and continuing step by step from that point until the error message was triggered (which was a consecuence of DesktopInfo::windowManager() not being able to read XDG_CURRENT_DESKTOP as it was not set).

Maybe others with KDE (instead os sway) can try a similar approach to figure out where exactly the error is coming from.

snyssen commented 2 years ago

I echoed $XDG_CURRENT_DESKTOP and it returned KDE, so I don't think it's problem for me. I could indeed try to debug the application myself, but since I have literally no experience in C++ I will have to learn its tools first... Will update if I ever get to it, but more realistically I will stick to the alternative for now.

greenfoo commented 2 years ago

It's been raining all day here... so I decided to install KDE and try to debug this issue :)

The result is pull request #2495, which (at least in my computer) seems to fix the problem. It might break backwards compatibility... so let's discuss that on the PR thread.

In the meantime, @snyssen, can you please apply that patch + rebuild + confirm it works also for you? Thanks!

snyssen commented 2 years ago

I built your commit locally and it worked flawlessly, thank you ! Now let's just hope your PR will be merged soon :)

borgmanJeremy commented 2 years ago

I'll take a look at the pr this week. Thanks!

m2jest1c commented 2 years ago

Interesting. I'm on Fedora 35 as well, with KDE Wayland. I compiled using with the fixes in that pull request and I've still got this issue.

❱❱❱ flameshot gui 
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
qt.svg: Invalid path data; path truncated.
[14:25:13] [cost 3.007s] flameshot gui                                                                                                                                                                            

No clue what it's talking about in terms of qt.svg. Flameshot works fine in Xorg though.

I've removed all other versions of Flameshot, and this version was installed using make install.

Glad to see I'm not alone though, and that there's attempts at fixing it that have worked for others. I can provide other logs if needed.

snyssen commented 2 years ago

Hi,

Sorry to dig out this issue, but do we have an expected date for a new release? I am still unable to use Flameshot since this fix hasn't been deployed yet.

Have a nice day, Simon Nyssen.

mmahmoudian commented 2 years ago

@snyssen We don't have a set date for the next release. There are few things that we would like to merge and handle before that and all devs are busy with their daily lives. I suggest for the time being you either build from source (and perhaps create a symlink), or you install using our nightly builds.

Building from source is very straightforward: https://flameshot.org/docs/installation/source-code/

snyssen commented 2 years ago

Thank you, I will take a look at this :smile:

SohamG commented 2 years ago

Has this been solved? I still have this issue on KDE Wayland (NixOS, built from nixpkgs-unstable)

mmahmoudian commented 2 years ago

@SohamG

Has this been solved?

Yes, via #2495

I still have this issue on KDE Wayland

  1. Make sure you have the latest version of flameshot
  2. Have you read this: https://flameshot.org/docs/guide/wayland-help/#kde-wayland
leiha commented 2 years ago

i have this error too : qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

Maybe can help : with kde wayland ( Plasma 5.24.6 ) i must install this dependencies for flameshot v12.1.0 worked. ( i am on arch but maybe it's the same in others linux )

mmahmoudian commented 2 years ago

@leiha Thanks for the comment. We always try to keep the AUR updated and therefore the dependencies for Arch-based distros can be adopted from there. Check out the line 62-64: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=flameshot-git

aaravrav commented 2 months ago

Still happening: Flameshot v12.1.0 (-) Compiled with Qt 5.15.10 6.9.7-arch1-1 Arch Linux with KDE Plasma 6 on Wayland

Does not save screenshot to clipboard on ctrl+c:

qt.qpa.wayland: Wayland does not support QWindow::requestActivate() # happens right after command
qt.qpa.wayland: Wayland does not support QWindow::requestActivate() # happens on Ctrl+c