Skip to content

Commit

Permalink
Make UI appear on Qt::ApplicationActive for MacOS
Browse files Browse the repository at this point in the history
If the status icon plugin is used with close to system tray
the UI main window is closed. On Mac OS there is not an easy
way to make it reappear. The system tray activation trigger
is disabled on Mac OS. This is for good reason due to one
button mouse support and that this usually is intended to
open the status/tray menu. Instead we can handle the
application state change activate signal which will fire
when the dock icon is clicked.
  • Loading branch information
jkl1337 committed Nov 22, 2024
1 parent fd4cf41 commit 6947187
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/qtui/main_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <libaudcore/drct.h>
#include <libaudcore/i18n.h>
#include <libaudcore/interface.h>
#include <libaudcore/plugins.h>
#include <libaudcore/runtime.h>

Expand Down Expand Up @@ -221,8 +222,17 @@ MainWindow::MainWindow()

/* set initial keyboard focus on the playlist */
m_playlist_tabs->currentPlaylistWidget()->setFocus(Qt::OtherFocusReason);

#ifdef Q_OS_MAC
QObject::connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, [](auto state){
if (state == Qt::ApplicationState::ApplicationActive) {
aud_ui_show(true);
}
});
#endif
}


MainWindow::~MainWindow()
{
QSettings settings(m_config_name, "QtUi");
Expand Down

0 comments on commit 6947187

Please sign in to comment.