diff --git a/CMakeLists.txt b/CMakeLists.txt index fbf5fab5a..b2abc948b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,9 @@ endif() add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia) +if (UNIX AND NOT APPLE) + find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) +endif() find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS}) if (KF5_OPTIONAL_COMPONENTS) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) diff --git a/plugins/notifications/CMakeLists.txt b/plugins/notifications/CMakeLists.txt index 0a551f272..f5999ba4c 100644 --- a/plugins/notifications/CMakeLists.txt +++ b/plugins/notifications/CMakeLists.txt @@ -21,4 +21,11 @@ target_link_libraries(kdeconnect_notifications Qt5::DBus KF5::Notifications KF5::I18n + KF5::WindowSystem ) + +if (UNIX AND NOT APPLE) + target_link_libraries(kdeconnect_notifications + Qt::X11Extras + ) +endif() diff --git a/plugins/notifications/notificationsplugin.cpp b/plugins/notifications/notificationsplugin.cpp index 296e9e378..b8bace985 100644 --- a/plugins/notifications/notificationsplugin.cpp +++ b/plugins/notifications/notificationsplugin.cpp @@ -11,6 +11,11 @@ #include #include +#include + +#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) +#include +#endif K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json") @@ -152,6 +157,12 @@ void NotificationsPlugin::replyRequested(Notification* noti) SendReplyDialog* dialog = new SendReplyDialog(originalMessage, replyId, appName); connect(dialog, &SendReplyDialog::sendReply, this, &NotificationsPlugin::sendReply); dialog->show(); +#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) + auto window = qobject_cast(dialog->windowHandle()); + if (window && QX11Info::isPlatformX11()) { + KStartupInfo::setNewStartupId(window, QX11Info::nextStartupId()); + } +#endif dialog->raise(); } diff --git a/plugins/notifications/sendreplydialog.cpp b/plugins/notifications/sendreplydialog.cpp index 1bbd8a0f6..473a32ee9 100644 --- a/plugins/notifications/sendreplydialog.cpp +++ b/plugins/notifications/sendreplydialog.cpp @@ -32,6 +32,7 @@ SendReplyDialog::SendReplyDialog(const QString& originalMessage, const QString& setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect"), QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnect.svg"))))); setAttribute(Qt::WA_DeleteOnClose); + m_ui->replyEdit->setFocus(); } SendReplyDialog::~SendReplyDialog() = default;