Skip to content

Commit

Permalink
fix: clicking native notification opens the message
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavbhatt committed Oct 19, 2024
1 parent 2777c3e commit c846d65
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,22 @@ void MainWindow::setNotificationPresenter(QWebEngineProfile *profile) {
.settings()
.value("notificationTimeOut", 9000)
.toInt();
QIcon icon(QPixmap::fromImage(notification->icon()));
auto notificationPtr = notification.get();
connect(m_systemTrayIcon, &QSystemTrayIcon::messageClicked, this,
[this, notificationPtr]() {
if (notificationPtr) {
notificationPtr->click();
}
});

if (userDesktopEnvironment.contains("gnome", Qt::CaseInsensitive)) {
// cannot show notification normally on gnome shell when using
// custom icon.
m_systemTrayIcon->showMessage(notification->title(),
notification->message(),
QSystemTrayIcon::Critical, 0);
} else {
QIcon icon(QPixmap::fromImage(notification->icon()));
m_systemTrayIcon->showMessage(
notification->title(), notification->message(), icon, timeout);
}
Expand Down

0 comments on commit c846d65

Please sign in to comment.