Fix wayland activation
Adds support for xdg_activation_v1 when calling the application from the system tray by using KStatusNotifier which supports it. Listens to XDG_ACTIVATION_TOKEN as it's passed when we are started from dbus.
This commit is contained in:
committed by
Aleix Pol Gonzalez
parent
5c86692fb5
commit
265fcbfead
25
src/trayicon_sni.cpp
Normal file
25
src/trayicon_sni.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "trayicon_sni.h"
|
||||
#include <KWindowSystem>
|
||||
|
||||
TrayIcon::TrayIcon(QObject *parent)
|
||||
: KStatusNotifierItem(parent)
|
||||
{
|
||||
setIconByName("org.kde.neochat");
|
||||
connect(this, &KStatusNotifierItem::activateRequested, this, [this] {
|
||||
KWindowSystem::setCurrentXdgActivationToken(providedToken());
|
||||
Q_EMIT showWindow();
|
||||
});
|
||||
}
|
||||
|
||||
void TrayIcon::show()
|
||||
{
|
||||
setStatus(Active);
|
||||
}
|
||||
|
||||
void TrayIcon::hide()
|
||||
{
|
||||
setStatus(Passive);
|
||||
}
|
||||
Reference in New Issue
Block a user