Bug 386271 - [Wayland] Implement "Active window" mode in the KWin screenshot plugin
Summary: [Wayland] Implement "Active window" mode in the KWin screenshot plugin
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: git master
Platform: Arch Linux Linux
: HI wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: usability, wayland
: 392585 437782 443942 444120 448205 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-27 22:27 UTC by Patrick Silva
Modified: 2022-04-05 21:19 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In: Spectacle 21.12 with Plasma 5.24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2017-10-27 22:27:42 UTC
neon dev unstable
Nothing happens when meta+print shortcut is pressed under Wayland.
Comment 1 Nate Graham 2017-10-28 01:12:51 UTC
Does Active Window mode also not work when invoked from the app's main window, or is this just a case of the keyboard shortcut not doing what it's supposed to?
Comment 2 Patrick Silva 2017-10-28 01:29:16 UTC
Also It does not work when I open spectacle from apps menu, select "Active window" in "Area" drop down, set delay and click "take a new screenshot".
Spectacle takes an empty "screenshot".
Comment 3 Nate Graham 2017-10-28 01:34:18 UTC
Thanks for the info!
Comment 4 Patrick Silva 2018-01-23 13:10:38 UTC
same problem with spectacle 17.12.1 + plasma 5.12 beta on Arch Linux.
Comment 5 jm.ouwerkerk 2018-03-11 21:39:32 UTC
Note that by contrast "window under cursor" mode does work.
Comment 6 Andrius Štikonas 2018-04-05 19:13:52 UTC
*** Bug 392585 has been marked as a duplicate of this bug. ***
Comment 7 Patrick Silva 2018-05-18 21:49:55 UTC
same bug on Arch Linux, plasma 5.13 beta, spectacle 18.04.1.
Comment 8 null 2018-05-18 21:52:14 UTC
> same bug on Arch Linux, plasma 5.13 beta, spectacle 18.04.1.
This is now the third bug you added this message to. Please stop spamming Bugzilla, because as I've explained to you before, we are only interested in //new// information, e.g. new steps to reproduce, or whether the bug has been solved but is still marked as open.
Comment 9 Aleix Pol 2018-11-22 16:09:46 UTC
Git commit 053e903727138c30609b9cc92aeeab46101b148f by Aleix Pol.
Committed on 22/11/2018 at 16:07.
Pushed by apol into branch 'master'.

Don't advertise on Wayland features that aren't available

Summary:
It's quite stressful and it clearly doesn't push developers to implement the features.
Related: bug 377157

Test Plan: Now I don't choose to take a screenshot of the active window and get sad when I can't.

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: hein, ngraham, #spectacle

Tags: #spectacle

Differential Revision: https://phabricator.kde.org/D17082

M  +3    -3    src/Gui/KSMainWindow.cpp
M  +1    -1    src/Gui/KSMainWindow.h
M  +13   -7    src/Gui/KSWidget.cpp
M  +1    -1    src/Gui/KSWidget.h
M  +1    -0    src/PlatformBackends/DummyImageGrabber.h
M  +1    -0    src/PlatformBackends/ImageGrabber.h
M  +1    -0    src/PlatformBackends/KWinWaylandImageGrabber.h
M  +1    -0    src/PlatformBackends/X11ImageGrabber.h
M  +1    -1    src/SpectacleConfig.cpp
M  +1    -1    src/SpectacleCore.cpp

https://commits.kde.org/spectacle/053e903727138c30609b9cc92aeeab46101b148f
Comment 10 Boudhayan Gupta 2019-06-11 23:28:35 UTC
This is a feature that has to be implemented in KWin. Once the feature is available, it's simply a matter of invoking the right DBus call into KWin.
Comment 11 Vlad Zahorodnii 2019-06-12 08:53:23 UTC
Hmm, it seems like there are several ways to take a screenshot of the active window:

* either by pressing Meta+PrtScr shortcut. This one seems to be straightforward to implement. Spectacle calls a method to take a screenshot and kwin spews pixel data to a pipe;

* or by pressing PrtScr and then selecting "Active window" capture mode. This one is not straightforward. Spectacle would need to ensure that its window is closed before asking kwin to take a screenshot.

Also, I wonder what security implications this feature will have.
Comment 12 Martin Flöser 2019-06-12 19:42:29 UTC
From a security perspective the best way would be KWin to handle the shortcut and launch spectacle (or any other tool) and pipe it the screenshot. The alternative would be spectacle asking and KWin showing the same user interaction pattern to click the window or some other way to have the user confirm that it wants a screenshot to be taken. From a security perspective having a call to take screenshots is terrible. That was one of the biggest security issues on X11 (it allowed e.g. to take over a browser instance).
Comment 13 Patrick Silva 2021-01-24 16:51:25 UTC
This feature is still missing from Plasma 5.21 beta. :(
Comment 14 Nate Graham 2021-10-19 13:53:37 UTC
*** Bug 443942 has been marked as a duplicate of this bug. ***
Comment 15 Patrick Silva 2021-10-20 20:10:19 UTC
*** Bug 444120 has been marked as a duplicate of this bug. ***
Comment 16 Patrick Silva 2021-10-23 12:20:07 UTC
*** Bug 437782 has been marked as a duplicate of this bug. ***
Comment 17 Bug Janitor Service 2021-10-23 14:48:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/82
Comment 18 Bug Janitor Service 2021-10-23 14:48:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/82
Comment 19 Méven Car 2021-10-28 14:55:07 UTC
In fact since we have a copy whole screen option that is slightly guarded by the key in the desktop files, KWin should allow to take ActiveWindow screenshots as well.

https://invent.kde.org/graphics/spectacle/-/merge_requests/82 could be merged in the meantime.
Comment 20 Bug Janitor Service 2021-10-29 08:56:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1582
Comment 21 Bug Janitor Service 2021-10-29 09:07:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/90
Comment 22 Vlad Zahorodnii 2021-10-29 12:07:04 UTC
Git commit b135a1c7b09182dd48b42cc81db6e088bb561901 by Vlad Zahorodnii.
Committed on 29/10/2021 at 12:06.
Pushed by vladz into branch 'master'.

effects/screenshot: Add org.kde.KWin.ScreenShot2.CaptureActiveWindow

M  +42   -0    src/effects/screenshot/org.kde.KWin.ScreenShot2.xml
M  +26   -0    src/effects/screenshot/screenshotdbusinterface2.cpp
M  +2    -0    src/effects/screenshot/screenshotdbusinterface2.h

https://invent.kde.org/plasma/kwin/commit/b135a1c7b09182dd48b42cc81db6e088bb561901
Comment 23 Vlad Zahorodnii 2021-10-29 12:07:16 UTC
Git commit 9db9ace43a386e07df15a8d3fd28a343c83e6d66 by Vlad Zahorodnii.
Committed on 29/10/2021 at 09:46.
Pushed by vladz into branch 'master'.

Add support for Active Window mode on Wayland

M  +27   -1    src/Platforms/PlatformKWinWayland2.cpp
M  +15   -0    src/Platforms/PlatformKWinWayland2.h

https://invent.kde.org/graphics/spectacle/commit/9db9ace43a386e07df15a8d3fd28a343c83e6d66
Comment 24 Patrick Silva 2022-01-10 20:41:28 UTC
*** Bug 448205 has been marked as a duplicate of this bug. ***