diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 790afbeca..f7ac28a3c 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -843,6 +843,11 @@ void MainWindow::createKeyboardShortcuts()
m_ui->actionDelete->setShortcutContext(Qt::WidgetShortcut); // nullify its effect: delete key event is handled by respective widgets, not here
m_ui->actionDownloadFromURL->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O);
m_ui->actionExit->setShortcut(Qt::CTRL + Qt::Key_Q);
+#ifdef Q_OS_MAC
+ m_ui->actionCloseWindow->setShortcut(QKeySequence::Close);
+#else
+ m_ui->actionCloseWindow->setVisible(false);
+#endif
QShortcut *switchTransferShortcut = new QShortcut(Qt::ALT + Qt::Key_1, this);
connect(switchTransferShortcut, &QShortcut::activated, this, &MainWindow::displayTransferTab);
@@ -978,6 +983,16 @@ void MainWindow::on_actionExit_triggered()
close();
}
+#ifdef Q_OS_MAC
+void MainWindow::on_actionCloseWindow_triggered()
+{
+ // On macOS window close is basically equivalent to window hide.
+ // If you decide to implement this functionality for other OS,
+ // then you will also need ui lock checks like in actionExit.
+ close();
+}
+#endif
+
QWidget *MainWindow::currentTabWidget() const
{
if (isMinimized() || !isVisible())
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
index f3e1b2a93..ebb3ce3fa 100644
--- a/src/gui/mainwindow.h
+++ b/src/gui/mainwindow.h
@@ -187,7 +187,9 @@ private slots:
void toolbarTextBeside();
void toolbarTextUnder();
void toolbarFollowSystem();
-#ifndef Q_OS_MAC
+#ifdef Q_OS_MAC
+ void on_actionCloseWindow_triggered();
+#else
void toggleVisibility(const QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger);
void createSystrayDelayed();
void updateTrayIconMenu();
diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui
index 85003cb85..e3a74ba37 100644
--- a/src/gui/mainwindow.ui
+++ b/src/gui/mainwindow.ui
@@ -90,6 +90,7 @@
+
@@ -466,6 +467,11 @@
Critical Messages
+
+
+ Close Window
+
+