Enable middle-click on systray icon to play/pause

This commit is contained in:
Bart De Vries 2023-12-15 13:03:14 +01:00
parent 6dbe0fd921
commit 739e046837
1 changed files with 5 additions and 0 deletions

View File

@ -21,12 +21,17 @@ SystrayIcon::SystrayIcon(QObject *parent)
: QSystemTrayIcon(parent) : QSystemTrayIcon(parent)
{ {
setIconColor(intToIconColorEnum(SettingsManager::self()->trayIconType())); setIconColor(intToIconColorEnum(SettingsManager::self()->trayIconType()));
setToolTip(i18nc("@info:tooltip",
"Kasts\n"
"Middle-click to play/pause"));
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
connect(this, &QSystemTrayIcon::activated, this, [this](QSystemTrayIcon::ActivationReason reason) { connect(this, &QSystemTrayIcon::activated, this, [this](QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::Trigger) { if (reason == QSystemTrayIcon::Trigger) {
Q_EMIT raiseWindow(); Q_EMIT raiseWindow();
} else if (reason == QSystemTrayIcon::MiddleClick) {
AudioManager::instance().playPause();
} }
}); });