Commit c6ad1d6a authored by David Redondo's avatar David Redondo 🏎 Committed by Nate Graham
Browse files

Don't exit when running in gui mode and notification times out

Summary: If a screenshot is taken in DBus or background mode and the running instance is 'upgraded' to gui mode while the notification is displaying the instance would still exit after the notification timed out or was destroyed. So simply check if we are running in gui mode before exiting.

Test Plan:
  # Take a screenshot via shortcut without opening Spectacle

  # While the notifcation displays open Spectacle for example via shortcut (don't run the binary directly)

  # Spectacle doesn't exit when the notifcation times out or is closed

Reviewers: #spectacle, broulik, ngraham

Reviewed By: #spectacle, ngraham

Subscribers: ngraham, #spectacle

Tags: #spectacle

Differential Revision:
parent a0797b39
......@@ -290,9 +290,17 @@ void SpectacleCore::doNotify(const QUrl &savedAt)
connect(notify, &KNotification::action1Activated, this, [this, savedAt] {
new KRun(savedAt, nullptr);
QTimer::singleShot(250, this, &SpectacleCore::allDone);
QTimer::singleShot(250, this, [this] {
if (mStartMode != GuiMode) {
emit allDone();
connect(notify, &QObject::destroyed, this, [this] {
if (mStartMode != GuiMode) {
emit allDone();
connect(notify, &QObject::destroyed, this, &SpectacleCore::allDone);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment