Bug 414739 - Spectacle is killed when the notification for the last capture goes away
Summary: Spectacle is killed when the notification for the last capture goes away
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 19.08.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-02 06:05 UTC by Frederick Zhang
Modified: 2021-10-31 11:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 20.08.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederick Zhang 2019-12-02 06:05:04 UTC
SUMMARY
If Spectacle is launched before the notification for the last capture disappears, it will be killed when the notification goes away.

STEPS TO REPRODUCE
1. Launch Spectacle
2. Click Save, Spectacle closes and a notification pops up
3. Launch Spectacle again
4. Wait until the notification disappears

OBSERVED RESULT
Spectacle is killed when the notification disappears, which may interrupt user's current capture.

EXPECTED RESULT
Notifications for previous captures do not cause current Spectacle to be killed.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2
Kernel Version: 5.3.13-arch1-1
OS Type: 64-bit

ADDITIONAL INFORMATION
I'm using Xorg.
Comment 1 Nate Graham 2019-12-02 22:11:08 UTC
Darn, I know we've seen and fixed this before. :/ Cannot reproduce with git master. David, is this one of the ones that's already fixed in 19.12?
Comment 2 David Redondo 2019-12-03 11:56:26 UTC
If I understand it correctly this special case is not fixed:
- Quit after saving is checked
- You save, spectacle closes but the process is running because we show the notification
- Hit print screen again, runnning process creates a new window
- Note that quit after save is still checked
- Notification times out, because quit after save is checked spectacle terminates itself
Comment 3 Méven Car 2020-06-05 09:31:33 UTC
Git commit dec0e6cef23ac35754aa537db6d7ace42b23ca2a by Méven Car.
Committed on 05/06/2020 at 09:10.
Pushed by meven into branch 'master'.

Refactor Spectacle to run in single instance mode with KDBusService::Unique

Summary:
Since Spectacle got DBus activation support in 09cd11881d828da35c46c48da79f2d988e6a78cc, it has been run in multiple instance mode.
But it has been shaddowed by using qbus ee862d161a480408338d00b8826c915f7a97575c in the desktop file to mimic singleton behavior.

This refactors Spectacle to run in true single instance mode using KDBusService::Unique.
This is to allow Spectacle to have its executable in its Exec desktop Entry, to allow KWin to match the executable to the service file, itself to allow screenshots under Wayland without intermediate click.

The listed bugs are fixed incidently except for 414739 where a simple fix was added in screenShotUpdated.
Related: bug 420477, bug 412186

Test Plan:
Start spectacle, alternatively, from shortcut, command line.
Take screenshots, from alternative ways.

There is always at most one Spectacle window unless launched with `--new-instance`.

Reviewers: davidre, ngraham, bport, davidedmundson, apol

Reviewed By: davidre

Subscribers: broulik, anthonyfieroni, #spectacle

Tags: #spectacle

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

M  +2    -2    desktop/org.kde.spectacle.desktop.cmake
M  +30   -89   src/Main.cpp
M  +170  -105  src/SpectacleCore.cpp
M  +8    -10   src/SpectacleCore.h
M  +5    -10   src/SpectacleDBusAdapter.cpp
M  +0    -31   src/SpectacleDBusAdapter.h

https://invent.kde.org/graphics/spectacle/commit/dec0e6cef23ac35754aa537db6d7ace42b23ca2a
Comment 4 Patrick Silva 2020-06-30 12:30:53 UTC
This bug is still reproducible on neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.72.0
Qt Version: 5.14.2
Comment 5 Frederick Zhang 2021-10-21 13:46:32 UTC
I'm using Spectacle 21.08.2 on Arch and I can confirm this has been fixed.

Though a little friction in terms migration happened in the Custom Shortcuts. There is a Custom Shortcuts -> Spectacle -> Rectangular region to clipboard in my config, which I think comes with Plasma itself (?), was still using `spectacle -bcr`. I updated it to `spectacle -bcri` to stop new Spectacle windows from being killed by notifications of this shortcut.

Thanks everyone for the help.
Comment 6 Patrick Silva 2021-10-21 14:39:34 UTC
I can reproduce with Spectacle 21.08.2 on Arch Linux, at least on Wayland.

1. open Spectacle
2. make sure 'Full screen' mode is selected in 'Area' combobox
3. save the screenshot (Plasma displays a notification)
4. reopen Spectacle by pressing printscreen key
5. wait the notification to disappear

Result: Spectacle closes when the notification disappears.
Comment 7 Frederick Zhang 2021-10-21 14:59:48 UTC
@Patrick Is it possible that you've got an old copy of the .desktop file in e.g. ~/.local/share/applications?
Comment 8 Patrick Silva 2021-10-31 11:56:12 UTC
(In reply to Frederick Zhang from comment #7)
> @Patrick Is it possible that you've got an old copy of the .desktop file in
> e.g. ~/.local/share/applications?

I don't think this bug is related to .desktop file because I can also reproduce on another system (neon unstable).
Al least on neon unstable, there is no .desktop file for Spectacle in ~/.local/share/applications.