Bug 449986 - New capture mode: Window by properties
Summary: New capture mode: Window by properties
Status: REPORTED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 19.12.3
Platform: Kubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-11 01:28 UTC by John
Modified: 2023-05-02 23:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Hall of mirrors effect when spamming the PrtScr button (170.00 KB, image/png)
2022-02-11 01:28 UTC, John
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John 2022-02-11 01:28:22 UTC
Created attachment 146566 [details]
Hall of mirrors effect when spamming the PrtScr button

It would be nice to be able to screenshot a specific window by its properties, so that you can target a particular window even if it's not active or under the cursor.

One particular use case that would benefit from this is taking rapid, sequential screenshots as described in https://bugs.kde.org/show_bug.cgi?id=443060

I'm not sure what the best UI/workflow for this would be, but I'm envisioning something like:

1. Select "Window (by properties)" from the "Area" drop-down.
2. When you select that option, a picker like the one you get in the "Window Rules" part of System Settings when you click "Detect Window Properties" shows up and you click the window you want.
3. A dialog (again, similar to what you get when setting up window rules in System Settings) comes up that lets you pick which properties you want to apply to the filter.
4. When you click "Take a New Screenshot", Spectacle will screenshot the first window it finds that matches the properties.
5. The window properties will be saved for subsequent screenshots, using the same logic Spectacle currently uses to save the rectangular region information.

There seems to be some reference to this at the end of the comment history for https://bugs.kde.org/show_bug.cgi?id=411290 but I'm not sure enough to call this a duplicate (plus, that bug's main focus is something else anyway).

In other news, I just discovered the "Autosave the image to the default location" setting, but even with that enabled I can't just set "Active Window" and spam the PrtScr button 'cause as soon as I press it, Spectacle raises itself and then starts taking screenshots of itself instead.

On a side note, I've included a screenshot (taken by Spectacle) that shows what happens when you do this with a delay configured, for the amusement of the peanut gallery.  Although, you can also see the effect of having a little bit more transparent border added on each pass.  I did rename the file because the fractal filenames were getting a little out of control (you'll see what I mean along the bottom).  I'm honestly not sure if this is a bug or just Spectacle's doing what it's told and my not expecting the result I got from the instructions I gave.  :)

SOFTWARE/OS VERSIONS

OS Version: Kubuntu 20.04 (all packages are the stock versions that come with this Kubuntu release)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Comment 1 Noah Davis 2023-05-02 23:51:46 UTC
I'm not sure about putting this in the UI since it seems very technical and niche, but maybe we could add it as a CLI option. The option could take a window ID argument for the exact window, but it would only work with KWin. The ID could be found by using `qdbus org.kde.KWin /KWin org.kde.KWin.queryWindowInfo` and looking for something like `uuid: {fac6b23b-6156-4079-ab41-9f2511bd41db}` in the output. If we wanted to add it to the UI, maybe we could add an option to do a delayed capture after selecting a window interactively. Of course in order for this to work, the exact instance of the window you got the ID for has to still be alive. If you want to capture something like a menu and the menu disappears, the ID will be invalid next time you open the menu.
Comment 2 Noah Davis 2023-05-02 23:59:12 UTC
If you want to capture by resource name, application class name, window title, desktop file name, or something else, we'll probably have to add some new screenshot DBus API to KWin.