Skip to content

Commit

Permalink
fix: cursor is always in busy state sometimes
Browse files Browse the repository at this point in the history
see #250

I give it a timeout to workaround the situation a little bit.

Change-Id: I4b715b7455418caccb8416b446e92a55e80e47d3
  • Loading branch information
hualet committed Mar 20, 2019
1 parent 24fbd47 commit 79473df
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/widgets/dapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,23 @@ DApplicationPrivate::DApplicationPrivate(DApplication *q) :
{
#ifdef Q_OS_LINUX
StartupNotificationMonitor *monitor = StartupNotificationMonitor::instance();
QObject::connect(monitor, &StartupNotificationMonitor::appStartup, [this, q](const QString id) {
m_monitoredStartupApps.append(id);
q->setOverrideCursor(Qt::WaitCursor);
});
QObject::connect(monitor, &StartupNotificationMonitor::appStartupCompleted, [this, q](const QString id) {
auto cancelNotification = [this, q](const QString id) {
m_monitoredStartupApps.removeAll(id);
if (m_monitoredStartupApps.isEmpty()) {
q->setOverrideCursor(Qt::ArrowCursor);
}
};
QObject::connect(monitor, &StartupNotificationMonitor::appStartup, [this, q, &cancelNotification](const QString id) {
m_monitoredStartupApps.append(id);
q->setOverrideCursor(Qt::WaitCursor);
// Set a timeout of 15s in case that some apps like pamac-tray started
// with StartupNotify but don't show a window after startup finished.
QTimer::singleShot(15 * 1000, q, [id, &cancelNotification](){
cancelNotification(id);
});
});
QObject::connect(monitor, &StartupNotificationMonitor::appStartupCompleted,
q, cancelNotification);
#endif
}

Expand Down

0 comments on commit 79473df

Please sign in to comment.