Bug 430781

Summary: Spectacle asks for confirmation to take "Window under cursor" screenshot on Wayland
Product: [Applications] Spectacle Reporter: Patrick Silva <bugseforuns>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: herzenschein, kde, meven29, nate, noahadvs, qlumreg
Priority: NOR Keywords: wayland
Version: 22.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Patrick Silva 2020-12-24 11:04:42 UTC
STEPS TO REPRODUCE
1. start Wayland session
2. open Spectacle by pressing printscreen key
3. set "Area" to "Window under cursor"
4. click on "Take a new screenshot" button

OBSERVED RESULT
Spectacle says "Select window to screen shot with left click or Enter. Escape or right click to cancel". If I cancel with Escape key or right click, Spectacle opens and displays "Could not take a screenshot. Please report this bug here: create a spectacle bug" inline message.

EXPECTED RESULT
Spctacle should immadiately take a screenshot in "Window under cursor" mode after
we click on "Take a new screenshot" button

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.20.80
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Comment 1 Thiago Sueto 2021-01-22 02:02:14 UTC
I can reproduce this consistently every time on current Spectacle from git (21.03.70).
Comment 2 qlum 2021-08-24 13:21:28 UTC
From what I can see this may be related to global cursor positions being unavailable under wayland.
Some other kde applications are facing similar issues:
https://bugs.kde.org/show_bug.cgi?id=411681
https://bugs.kde.org/show_bug.cgi?id=429177
Comment 3 Patrick Silva 2021-09-18 15:35:32 UTC
if I press ESC while confirmation popup is visible, Spectacle shows this error:

"Cannot save an empty screenshot image."

Operating System: Arch Linux
KDE Plasma Version: 5.22.90
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 4 Méven Car 2021-10-26 12:52:19 UTC
(In reply to Patrick Silva from comment #3)
> if I press ESC while confirmation popup is visible, Spectacle shows this
> error:
> 
> "Cannot save an empty screenshot image."
> 

This is the currently expected behavior.

The OSD "Select window to screen shot with left click or Enter. Escape or right click to cancel" is in fact KWin.

In wayland we want to prevent unprivileged application to take any applications screenshots.
This is to prevent an application to say make screenshots of potentially sensitive information displayed on screen.

We don't have our mindset currently as to how support this use case for Wayland.
My guess would be to handle the screenshot shorcuts in KWin directly.

As a workaround, one can use screen capture with pipewire to obtain the same result, for instance with OBS.
Comment 5 Noah Davis 2023-05-03 00:28:32 UTC
This is intentional behavior, so I'm marking it as such. We should change the name of the capture mode once X11 is made to behave the same way as Wayland. Unrelated to this bug report, but before making X11 behave like Wayland, it would be good to find a way to make the interactive window selection capture menus.