Set associated window for tray icon

This commit is contained in:
Nicolas Fella
2023-04-12 18:37:10 +02:00
parent 10bdc1d3d1
commit a0b0a5d47f
3 changed files with 19 additions and 0 deletions

View File

@@ -4,6 +4,8 @@
#include "trayicon_sni.h"
#include <KWindowSystem>
#include "windowcontroller.h"
TrayIcon::TrayIcon(QObject *parent)
: KStatusNotifierItem(parent)
{
@@ -13,6 +15,12 @@ TrayIcon::TrayIcon(QObject *parent)
KWindowSystem::setCurrentXdgActivationToken(providedToken());
Q_EMIT showWindow();
});
connect(&WindowController::instance(), &WindowController::windowChanged, this, [this] {
#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
setAssociatedWindow(WindowController::instance().window());
#endif
});
}
void TrayIcon::show()