Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: delay to access dbus for trayicon #257

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions 3rdparty/qdbustrayicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ static QString iconTempPath()
return QDir::tempPath();
}

static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2")
.arg(QDBusConnection::sessionBus().baseService().replace(
QRegularExpression(QStringLiteral("[\\.:]")), QStringLiteral("_")));

// delay to access dbus.
static QString KDEItemFormat()
{
static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2")
.arg(QDBusConnection::sessionBus().baseService().replace(
QRegularExpression(QStringLiteral("[\\.:]")), QStringLiteral("_")));
return KDEItemFormat;
}
static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher");
static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications");
static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications");
Expand All @@ -83,7 +87,7 @@ QDBusTrayIcon::QDBusTrayIcon()
, m_menuAdaptor(nullptr)
, m_menu(nullptr)
, m_notifier(nullptr)
, m_instanceId(KDEItemFormat.arg(instanceCount))
, m_instanceId(KDEItemFormat().arg(instanceCount))
, m_category(QStringLiteral("ApplicationStatus"))
, m_defaultStatus(QStringLiteral("Active")) // be visible all the time. QSystemTrayIcon has no API to control this.
, m_status(m_defaultStatus)
Expand Down
Loading