diff --git a/src/kwatchgnupg/CMakeLists.txt b/src/kwatchgnupg/CMakeLists.txt
index 608ddc898..d98ff1f44 100644
--- a/src/kwatchgnupg/CMakeLists.txt
+++ b/src/kwatchgnupg/CMakeLists.txt
@@ -1,56 +1,57 @@
 # SPDX-FileCopyrightText: none
 # SPDX-License-Identifier: BSD-3-Clause
 set(kwatchgnupg_version 1.0)
 
 find_package(KF6Notifications ${KF_MIN_VERSION} CONFIG REQUIRED)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version-kwatchgnupg.h.in ${CMAKE_CURRENT_BINARY_DIR}/version-kwatchgnupg.h)
 
 set(kwatchgnupg_SRCS
   ../utils/kuniqueservice.cpp
   ../kleopatra_debug.cpp
   kwatchgnupgmainwin.cpp
   kwatchgnupgconfig.cpp
   aboutdata.cpp
   ../utils/kuniqueservice.h
   ../kleopatra_debug.h
   kwatchgnupgmainwin.h
   kwatchgnupgconfig.h
   aboutdata.h
   main.cpp
   kwatchgnupg.qrc
 )
 
 ecm_qt_declare_logging_category(kwatchgnupg_SRCS HEADER kwatchgnupg_debug.h IDENTIFIER KWATCHGNUPG_LOG CATEGORY_NAME org.kde.pim.kwatchgnupg
         DESCRIPTION "kwatchgnupg (kwatchgnupg)"
         OLD_CATEGORY_NAMES log_kwatchgnupg
         EXPORT KLEOPATRA
     )
 
 if(WIN32)
   set(kwatchgnupg_SRCS ${kwatchgnupg_SRCS} ../utils/gnupg-registry.c)
 endif()
 
 file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/images/*-apps-org.kde.kwatchgnupg.*")
 ecm_add_app_icon(kwatchgnupg_SRCS ICONS ${ICONS_SRCS})
 ecm_install_icons(ICONS ${ICONS_SRCS} DESTINATION ${KDE_INSTALL_ICONDIR})
 
 add_executable(kwatchgnupg ${kwatchgnupg_SRCS})
 if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
     set_target_properties(kwatchgnupg PROPERTIES UNITY_BUILD ON)
 endif()
 
 
 target_link_libraries(kwatchgnupg
   KF6::DBusAddons
   KF6::XmlGui
   KF6::Notifications
   KF6::I18n
   KF6::GuiAddons
   KPim6::Libkleo
   KF6::CoreAddons
   KF6::Crash
+  KF6::WindowSystem
 )
 
 install(TARGETS kwatchgnupg ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
 install(FILES org.kde.kwatchgnupg.desktop DESTINATION ${KDE_INSTALL_APPDIR})
diff --git a/src/kwatchgnupg/main.cpp b/src/kwatchgnupg/main.cpp
index 52625ca4d..12d9757ef 100644
--- a/src/kwatchgnupg/main.cpp
+++ b/src/kwatchgnupg/main.cpp
@@ -1,42 +1,53 @@
 /*
     This file is part of Kleopatra, the KDE keymanager
     SPDX-FileCopyrightText: 2001, 2002, 2004 Klarälvdalens Datakonsult AB
 
     SPDX-License-Identifier: GPL-2.0-or-later
 */
 
 #include <config-kleopatra.h>
 
 #include "aboutdata.h"
 #include "kwatchgnupgmainwin.h"
 #include "utils/kuniqueservice.h"
 
 #include "kwatchgnupg_debug.h"
 #include <KCrash>
 #include <KLocalizedString>
+#include <KWindowSystem>
 #include <QApplication>
 #include <QCommandLineParser>
 
 int main(int argc, char **argv)
 {
     QApplication app(argc, argv);
 
     KLocalizedString::setApplicationDomain(QByteArrayLiteral("kwatchgnupg"));
 
     AboutData aboutData;
     KAboutData::setApplicationData(aboutData);
     QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("org.kde.kwatchgnupg")));
 
     KCrash::initialize();
 
     QCommandLineParser parser;
     aboutData.setupCommandLine(&parser);
     parser.process(app);
     aboutData.processCommandLine(&parser);
 
     KUniqueService service;
 
     auto mMainWin = new KWatchGnuPGMainWindow();
     mMainWin->show();
+
+    QObject::connect(&service, &KUniqueService::activateRequested, mMainWin, [mMainWin] {
+        if (mMainWin->isVisible()) {
+            KWindowSystem::updateStartupId(mMainWin->windowHandle());
+            KWindowSystem::activateWindow(mMainWin->windowHandle());
+        } else {
+            mMainWin->show();
+        }
+    });
+
     return app.exec();
 }