Bug 467118

Summary: When pressing PrintScreen key to take new screenshot with main window open while using the "printScreen key takes new screenshot" setting, Spectacle closes
Product: [Applications] Spectacle Reporter: David <david.cortes.rivera>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate, noahadvs
Priority: NOR    
Version: 22.12.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 23.04
Sentry Crash Report:

Description David 2023-03-09 16:24:02 UTC
SUMMARY
If I take a screenshot with spectacle, go to the annotation menu, and then press "Print Screen", the new screenshot taken in that print screen will be lost.

STEPS TO REPRODUCE
1. Press "Print screen" to trigger spectacle.
2. In the spectacle window, click "annotate" (button in the bottom panel).
3. Press "Print screen" again.
4. Select some rectangle area and press Enter.

OBSERVED RESULT
New screenshot is lost.

EXPECTED RESULT
Should open a **new** spectacle window to deal with the new screenshot.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-6-amd64 (64-bit)
Graphics Platform: X11
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 62.5 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: SLIMBOOK
Product Name: Executive

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2023-03-13 19:06:09 UTC
By default, the Print Screen button takes a new screenshot, overwriting the current one. If you want it to open a new window instead, there's an option for this in the settings window.
Comment 2 David 2023-03-13 19:06:57 UTC
(In reply to Nate Graham from comment #1)
> By default, the Print Screen button takes a new screenshot, overwriting the
> current one. If you want it to open a new window instead, there's an option
> for this in the settings window.

If I configure it like that, the new window will not pop-up with a screenshot of the screen at the moment it was taken.
Comment 3 Nate Graham 2023-03-13 19:29:46 UTC
That seems like a bug; please submit a new bug report for it.
Comment 4 David 2023-03-13 19:39:47 UTC
(In reply to Nate Graham from comment #3)
> That seems like a bug; please submit a new bug report for it.

I opened a new bug report: https://bugs.kde.org/show_bug.cgi?id=458713

But in any event, this is **still** a bug under the default configuration: it says "While Spectacle is running" -> "Press screenshot key to:" -> "Take a new Screenshot".

In this case, if I press the screenshot key, it doesn't take a new screenshot like it would do if the annotation toolbox was closed.
Comment 5 Nate Graham 2023-03-14 14:01:10 UTC
Oh, my mistake, sorry. I was misreading the original bug report. I can reproduce the issue with the upcoming 23.04 version too. I'll re-title the bug to be specific to what happens in the 23.04 version, since the 22.12 version won't be getting any more bugfixes and the code for is is substantially different (23.04 has a major rewrite of the app).
Comment 6 Noah Davis 2023-03-30 01:26:43 UTC
Git commit 068c6f548688b3425a94786cacadbf5302a6e123 by Noah Davis.
Committed on 30/03/2023 at 01:24.
Pushed by ndavis into branch 'master'.

Don't close all windows if activated by DBus with GUI and no CLI options

No options and having a GUI is a heuristic for activating Spectacle via
the PrintScreen key. Maybe we can find a better way to determine this
later, but I'm trying to keep up with the release schedule for now.

M  +7    -3    src/SpectacleCore.cpp

https://invent.kde.org/graphics/spectacle/commit/068c6f548688b3425a94786cacadbf5302a6e123
Comment 7 Noah Davis 2023-03-30 01:45:19 UTC
Git commit aef9e3a6a1df995e5f91dbdd922dc19d0f23b10f by Noah Davis.
Committed on 30/03/2023 at 01:45.
Pushed by ndavis into branch 'release/23.04'.

Don't close all windows if activated by DBus with GUI and no CLI options

No options and having a GUI is a heuristic for activating Spectacle via
the PrintScreen key. Maybe we can find a better way to determine this
later, but I'm trying to keep up with the release schedule for now.


(cherry picked from commit 068c6f548688b3425a94786cacadbf5302a6e123)

M  +7    -3    src/SpectacleCore.cpp

https://invent.kde.org/graphics/spectacle/commit/aef9e3a6a1df995e5f91dbdd922dc19d0f23b10f