Bug 389694 - Spectacle sometimes does not return to the shell prompt
Summary: Spectacle sometimes does not return to the shell prompt
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords: usability
: 382640 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-31 14:27 UTC by null
Modified: 2019-09-03 15:49 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.08.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description null 2018-01-31 14:27:37 UTC
- $ spectacle
- Save & Exit
- "Configure Notifications" in Plasma popup, Cancel
- spectacle keeps running in the shell (while I'd expect it to exit instead of hiding only)

Even when not opening the config dialog, the shell prompt does not return immediately but only when the popup is hidden again. Is there any reason the popup is tied to Spectacle running in the background?
Comment 1 Nate Graham 2018-02-10 04:51:28 UTC
This issue also prevents the Print Screen key from calling up Spectacle when there's already an instance silently running in the background, which is really annoying (workaround: `killall spectacle`).

This is caused by the following in KSMainWindow::saveAndExit():

    qApp->setQuitOnLastWindowClosed(false);
    ExportManager::instance()->doSave(QUrl(), true);
    hide();


It's been implemented this way to make sure that Spectacle doesn't quit before its notification appears on the screen, but there's doubtless a better way to do this.
Comment 2 Nate Graham 2018-02-10 13:46:24 UTC
It looks like Spectacle tries to handle this by connecting the allDone signal (which is emitted once the notification goes away) to &Application::quit:

QObject::connect(&core, &SpectacleCore::allDone, qApp, &QApplication::quit);

But that doesn't actually seem to work. The following trivial diff fixes it for me:

-    QObject::connect(&core, &SpectacleCore::allDone, qApp, &QApplication::quit);
+    QObject::connect(&core, &SpectacleCore::allDone, QApplication::quit);
Comment 3 Nate Graham 2018-02-10 14:06:13 UTC
Patch available: https://phabricator.kde.org/D10424
Comment 4 Nate Graham 2018-02-10 15:05:36 UTC
*** Bug 382640 has been marked as a duplicate of this bug. ***
Comment 5 null 2018-02-11 13:09:01 UTC
> - "Configure Notifications" in Plasma popup, Cancel
Another way to trigger the bug: Click on the preview in the notification to open Gwenview.

Note that clicking on "Open" does not trigger the bug, because there is this:

  QTimer::singleShot(250, this, &SpectacleCore::allDone);
Comment 6 null 2018-02-11 13:31:19 UTC
There are a lot of other ways to get Spectacle to stay open by configuring the notification differently, i.e. by choosing other notification options than "Show a message in a popup".

Either we always quit after a timeout, or we fix KNotification or Plasma to send a signal (destroyed/closed/ignored/activated etc.) regardless of the notification methods (which could be "None" too!).
Comment 7 Nate Graham 2018-03-09 17:40:53 UTC
*** Bug 391611 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2018-03-09 17:41:42 UTC
*** Bug 374864 has been marked as a duplicate of this bug. ***
Comment 9 null 2018-06-01 20:34:59 UTC
More hints to solve this bug: https://phabricator.kde.org/D7971#272308
Comment 10 Antonio Prcela 2019-08-28 21:11:57 UTC
Might fix it with this one:
https://phabricator.kde.org/D23534
Comment 11 David Redondo 2019-09-03 14:23:29 UTC
Git commit e98249c30917ef84f3f982b29c33dc90714fdb45 by David Redondo, on behalf of Antonio Prcela.
Committed on 03/09/2019 at 14:22.
Pushed by davidre into branch 'Applications/19.08'.

FIX: Properly close spectacle after Save As

Summary: BUG: 389694

Test Plan:
  # run Spectacle via shell
  # Have Quit after Save or Copy checked.
  # Hit Save As and save the image
  # Spectacle closes

Reviewers: davidre

Reviewed By: davidre

Subscribers: broulik, #spectacle

Tags: #spectacle

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

M  +2    -2    src/SpectacleCore.cpp

https://commits.kde.org/spectacle/e98249c30917ef84f3f982b29c33dc90714fdb45