fix: show notification only on primary screen

Prevents multiple notification windows from appearing (one per screen)
when receiving an incoming call. Now only shows on the primary display.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-02-06 18:08:28 +01:00
parent d00cff194f
commit ccd5a806e2

View file

@ -135,8 +135,8 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d
mMutex->unlock(); mMutex->unlock();
return false; return false;
} }
QList<QScreen *> allScreens = QGuiApplication::screens(); QScreen *primaryScreen = QGuiApplication::primaryScreen();
if (allScreens.size() > 0) { // Ensure to have a screen to avoid errors if (primaryScreen) { // Ensure to have a screen to avoid errors
QQuickItem *previousWrapper = nullptr; QQuickItem *previousWrapper = nullptr;
bool showAsTool = false; bool showAsTool = false;
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@ -149,12 +149,12 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d
} }
} }
#endif #endif
for (int i = 0; i < allScreens.size(); ++i) { // Only show notification on primary screen (not on all screens)
{
++mInstancesNumber; ++mInstancesNumber;
// Use QQuickView to create a visual root object that is // Use QQuickView to create a visual root object that is
// independant from current application Window // independant from current application Window
QScreen *screen = allScreens[i]; QScreen *screen = primaryScreen;
auto engine = App::getInstance()->mEngine; auto engine = App::getInstance()->mEngine;
const QUrl url(QString(NotificationsPath) + Notifier::Notifications[type].filename); const QUrl url(QString(NotificationsPath) + Notifier::Notifications[type].filename);
QObject::connect( QObject::connect(