flameshot icon indicating copy to clipboard operation
flameshot copied to clipboard

"Unable to capture screen" on KDE Wayland

Open skidunion opened this issue 1 year ago • 28 comments

Flameshot Version

Flameshot v12.1.0

Installation Type

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

Operating System type and version

openSUSE Tumbleweed 20220817

Description

Flameshot won't capture the screen under Wayland. Under X11, though, the screen capture is functional.

$ flameshot gui

flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
flameshot: info: Screenshot aborted.

All the relevant screen capturing packages are installed:

xdg-desktop-portal             | A portal frontend service for Flatpak    | 1.14.6-1.1                |    1.3 MiB
xdg-desktop-portal-kde         | QT/KF5 backend for xdg-desktop-portal    | 5.25.4-1.1                |  680.0 KiB
kwayland                       | KDE Wayland library                      | 5.97.0-1.1                |    2.1 MiB
kwayland-integration           | Integration plugins for various KDE f... | 5.25.4-1.1                |  190.1 KiB
libQt5WaylandClient5           | Qt 5 Wayland Addon                       | 5.15.5+kde39-1.1          |    1.5 MiB
libQt5WaylandCompositor5       | Qt 5 Wayland Addon                       | 5.15.5+kde39-1.1          |    1.8 MiB
libQt6WaylandClient6           | Qt 6 WaylandClient library               | 6.3.1-1.1                 |  900.2 KiB
libQt6WaylandCompositor6       | Qt 6 WaylandCompositor library           | 6.3.1-1.1                 |    1.8 MiB
qt6-wayland                    | Qt 6 Wayland libraries and tools         | 6.3.1-1.1                 |  864.4 KiB

Steps to reproduce

No response

Screenshots or screen recordings

No response

System Information

  1. openSUSE Tumbleweed 20220817
  2. image
  3. $ inxi --width 80 --system --graphics
    
    System:
      Host: ryzen-desktop Kernel: 5.19.1-1-default arch: x86_64 bits: 64
        Desktop: KDE Plasma v: 5.25.4 Distro: openSUSE Tumbleweed 20220817
    Graphics:
      Device-1: AMD Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT]
        driver: amdgpu v: kernel
      Display: wayland server: X.org v: 1.21.1.4 with: Xwayland v: 22.1.3
        compositor: kwin_wayland driver: X: loaded: modesetting unloaded: fbdev,vesa
        gpu: amdgpu resolution: 2560x1440
      OpenGL: renderer: AMD Radeon RX 5700 XT (navi10 LLVM 14.0.6 DRM 3.47
      5.19.1-1-default)
        v: 4.6 Mesa 22.1.4
    
    $ loginctl show-session $(loginctl show-user $(whoami) -p Display --value) -p Type --value
    
    wayland
    
    $ xrandr --listactivemonitors
    
    Monitors: 1
     0: +*XWAYLAND0 2560/600x1440/340+0+0  XWAYLAND0
    
    $ xrandr | grep -v " disconnected "
    
    Screen 0: minimum 16 x 16, current 2560 x 1440, maximum 32767 x 32767
    XWAYLAND0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
      2560x1440    164.78*+
      1920x1440    164.80  
      1600x1200    164.75  
      1440x1080    164.78  
      1400x1050    164.80  
      1280x1024    164.68  
      1280x960     164.67  
      1152x864     164.60  
      1024x768     164.78  
      800x600      164.38  
      640x480      164.26  
      320x240      163.69  
      1920x1200    164.78  
      1680x1050    164.78  
      1440x900     164.61  
      1280x800     164.65  
      720x480      164.18  
      640x400      164.01  
      320x200      161.83  
      2048x1152    164.69  
      1920x1080    164.82  
      1600x900     164.66  
      1368x768     164.67  
      1280x720     164.53  
      1024x576     164.65  
      864x486      164.71  
      720x400      164.23  
      640x350      164.46
    
    $ lspci | grep -i 'vga\|3d\|2d'
    
    2d:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch (rev c1)
    2f:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] (rev c1)
    
    $ uname -a 
    
    Linux ryzen-desktop 5.19.1-1-default #1 SMP PREEMPT_DYNAMIC Thu Aug 11 11:32:52 UTC 2022 (a5bf6c0) x86_64 x86_64 x86_64 GNU/Linux
    

skidunion avatar Aug 19 '22 18:08 skidunion

I had the same mistake

$flameshot Flashshot: error: unable to capture screen Flashshot: error: unable to capture screen qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

JulyLies avatar Aug 29 '22 14:08 JulyLies

I have the same problem, is there any progress?

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()
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()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

fzdwx avatar Sep 04 '22 12:09 fzdwx

The same on Ubuntu 22.04.1 LTS

dsokolowski avatar Sep 05 '22 10:09 dsokolowski

The call here will be reached but always result in an empty uri string.

https://github.com/flameshot-org/flameshot/blob/001726a565049ebfeb237a3a39b77104899b970e/src/utils/screengrabber.cpp#L69-L73

However, other screenshot apps for wayland that rely on the portal also don't work on KDE.

I think the problem might be somewhere else?

shenlebantongying avatar Sep 11 '22 02:09 shenlebantongying

Same issue on Manjaro 21.3.7 Gnome 42.4

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
flameshot: info: Screenshot aborted.

markovic-nikola avatar Sep 28 '22 12:09 markovic-nikola

Hi, same issue here on Ubuntu 21.10 / Gnome 43 / Wayland :

[10:03:54] ❯ flameshot gui                                                
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
flameshot: info: Screenshot aborted.

fulljackz avatar Oct 04 '22 08:10 fulljackz

same problem here on Arch Linux / Sway

tried debugging a bit, but I've never worked with Qt or dbus, so it wasn't very conclusive. I saw that grim is using some sort of wayland protocol instead of dbus, so maybe try looking into this? I've also heard of pipewire working for screencasts (that's how OBS does it iirc), so maybe add it as a fallback if it's easy enough.

RiedleroD avatar Oct 05 '22 19:10 RiedleroD

Works again on Plasma 5.26 for me

skidunion avatar Oct 13 '22 17:10 skidunion

problem persists in sway 1.7-9

RiedleroD avatar Oct 15 '22 20:10 RiedleroD

@RiedleroD Would it be possible for you to try to reproduce this in a clean VM (same OS, same Sway) and see if the issue persists?

mmahmoudian avatar Oct 17 '22 14:10 mmahmoudian

I'll try it out once I get home 👍

RiedleroD avatar Oct 17 '22 14:10 RiedleroD

sorry for the delay, I got really busy lately 😓

same behaviour with newest arch linux ISO, sway and very minimal config.

I had to set QEMU/KVM to use QXL to make sway work at all, set WLR_NO_HARDARE_CURSORS=1 to make the cursor visible, set XDG_CURRENT_DESKTOP=Sway to make Qt choose the correct rendering backend, and set the keyboard layout in the sway configs.

RiedleroD avatar Oct 21 '22 16:10 RiedleroD

oh wtf I installed the KDE implementation of xdg-desktop-portal and it started working… Maybe the WLR backend doesn't implement the functions correctly? Or maybe flameshot is assuming some UB. I'll investigate after dinner.

RiedleroD avatar Oct 21 '22 16:10 RiedleroD

alright so according to testing, it works if I install xdg-desktop-portal-wlr AND xdg-desktop-portal-(one of gtk, kde or gnome, but not lxqt for some reason)

I tried to find out if I could make wlr do whatever the other portals are doing, but I'm honestly stumped. I tested if the wlr backend works with other screenshot software, which it does. So idk.

RiedleroD avatar Oct 21 '22 18:10 RiedleroD

alright so according to testing, it works if I install xdg-desktop-portal-wlr AND xdg-desktop-portal-(one of gtk, kde or gnome, but not lxqt for some reason)

This is a very interesting finding. Very interesting!

mmahmoudian avatar Oct 21 '22 19:10 mmahmoudian

So after some thinking, I've come up with a hypothesis: flameshot uses some other xdg portal that isn't implemented by wlr. I don't know what flameshot does internally, so you might know more about that.

WLR only implements Screenshot and ScreenCast LxQt only implements FileChooser KDE and GTK both implement FileChooser, AppChooser, Print, Notification, Inhibit, Access, Account, Email, DynamicLauncher and Settings

Since both the kde and gtk backends work, I only listed the portals both support. the gnome portal depends on the gtk one, so I didn't list it. Since flameshot only works with WLR and either KDE or GTK installed, I suspect it needs one of the other listed portals. Probably Notification, though I'm not sure what the Inhibit and Access portals are doing…

In any case, if this can't be resolved properly for now, I suggest adding the workaround to the readme. I'd also add it to the arch wiki if you confirm that you can't fix it on your side of things.

RiedleroD avatar Oct 22 '22 09:10 RiedleroD

I can confirm this.

tan-wei avatar Oct 31 '22 14:10 tan-wei

Installing xdg-desktop-portal-wlr in addition to xdg-desktop-portal, xdg-desktop-portal-gtk and xdg-desktop-portal-gnome does allow me to run flameshot gui from a terminal, and things do work.

What's really strange is that if I use the .desktop file to launch flameshot (via the Gnome dash), nothing works at all except for the "Configure" option. I double-checked the /usr/share/applications/org.flameshot.Flameshot.desktop file, and nothing looks out of the ordinary there. I see that the "Take Screenshot" action is = flameshot gui, so I have no idea why it's not working. It should behave exactly the same way as running through a terminal correct?

I even tried copying the .desktop file to ~/.local/share/applications/ and started to make tweaks to it, but was unable to get things working...

System Info:

  • Arch Linux
  • Gnome 43
  • Flameshot 12.1.0-1

rstrube avatar Nov 01 '22 16:11 rstrube

/usr/share/applications/org.flameshot.Flameshot.desktop

met the same problem, running from terminal is ok

System Info:

  • Manjaro 22
  • GNONE 43.1
  • Flameshot 12.1.0, Compiled with Qt 5.15.5

tcstory avatar Dec 13 '22 02:12 tcstory

I am on Kubuntu 22.10 (wayland) and I don't have any issue except it doesn't copy to clipboard. I also installed flameshot from ubuntu repos.

Flameshot v12.1.0 (Debian 12.1.0-1)
Compiled with Qt 5.15.4

ahangarha avatar Dec 18 '22 07:12 ahangarha

Cannot run flameshot on Ubuntu 22.10

flameshot gui
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Qt: Session management error: None of the authentication protocols specified are supported

I installed xdg-desktop-portal-wlr, xdg-desktop-portal, xdg-desktop-portal-gtk and xdg-desktop-portal-gnome. This did not help me.

Flameshot v12.1.0 () Compiled with Qt 5.15.3

SANiMirrorOfLight avatar Dec 20 '22 10:12 SANiMirrorOfLight

@ahangarha

I am on Kubuntu 22.10 (wayland) and I don't have any issue except it doesn't copy to clipboard. I also installed flameshot from ubuntu repos.

How about running flameshot first (to have the daemon running) and then flameshot gui?

mmahmoudian avatar Dec 21 '22 06:12 mmahmoudian

I seem to have this error as well. Fedora 37, swaywm 1.7, Flameshot v12.1.0 (-) Compiled with Qt 5.15.5

xdg-desktop-portal.x86_64                            1.15.0-4.fc37                       @updates
xdg-desktop-portal-gnome.x86_64                      43.1-1.fc37                         @anaconda
xdg-desktop-portal-gtk.x86_64                        1.14.1-1.fc37                       @updates
xdg-desktop-portal-wlr.x86_64                        0.6.0-2.fc37                        @fedora

It works on terminal when I run flameshot gui but nothing happens if I bind it to a key. On terminal i also get the same errors

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()
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
flameshot: info: Screenshot aborted.

agentzhao avatar Jan 07 '23 06:01 agentzhao

Hey, you might want to check out my comment here, to me, it looks like this could be related.

dynobo avatar Jan 14 '23 10:01 dynobo

Here on a Sway installation by EndeavourOS the command just hangs forever, no error message. image

I have this installed.

grim 1.4.0-3
xdg-desktop-portal 1.16.0-1
xdg-desktop-portal-gnome 43.1-1
xdg-desktop-portal-gtk 1.14.1-1
xdg-desktop-portal-wlr 0.6.0-1

And ran

export XDG_CURRENT_DESKTOP=Sway
flameshot gui

J053Fabi0 avatar Jan 26 '23 04:01 J053Fabi0

@J053Fabi0 make sure you have read this: https://github.com/flameshot-org/flameshot/blob/master/docs/Sway%20and%20wlroots%20support.md

mmahmoudian avatar Jan 26 '23 10:01 mmahmoudian

I seem to have this error as well. Fedora 37, swaywm 1.7, Flameshot v12.1.0 (-) Compiled with Qt 5.15.5

xdg-desktop-portal.x86_64                            1.15.0-4.fc37                       @updates
xdg-desktop-portal-gnome.x86_64                      43.1-1.fc37                         @anaconda
xdg-desktop-portal-gtk.x86_64                        1.14.1-1.fc37                       @updates
xdg-desktop-portal-wlr.x86_64                        0.6.0-2.fc37                        @fedora

It works on terminal when I run flameshot gui but nothing happens if I bind it to a key. On terminal i also get the same errors

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()
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
flameshot: info: Screenshot aborted.

The cause of this was actually not setting the XDG_CURRENT_DESKTOP variable in swaywm, so the keybind didn't work. But since then I have updated my kernel and seem to be facing a new problem, where flameshot is unable to start.

#2151

agentzhao avatar Jan 29 '23 07:01 agentzhao

Arch Kernel: 6.6.14-1-lts Plasma 5.27.10 Wayland

Flameshot v12.1.0 (-) Compiled with Qt 5.15.10

When i try to run flameshot gui or make a screenshot any other way, i get this:

flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
flameshot: info: Screenshot aborted.

Flameshot-git: Flameshot v12.1.0 (3d21e496) Compiled with Qt 5.15.12

flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
QLayout: Attempting to add QLayout "" to SidePanelWidget "", which already has a layout
flameshot: info: Screenshot aborted.

Flameshot-old works for me, but it's painfully slow on wayland (which is why i'm trying to update it).

Foresteam avatar Jan 31 '24 20:01 Foresteam