mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Don't try to focus the window when clicking on tray icon on Wayland
This commit is contained in:
parent
68fde210c6
commit
384a71930d
1 changed files with 5 additions and 5 deletions
|
@ -143,7 +143,7 @@ void MainWindow::createTrayIconMenu() {
|
||||||
? tr::lng_disable_notifications_from_tray(tr::now)
|
? tr::lng_disable_notifications_from_tray(tr::now)
|
||||||
: tr::lng_enable_notifications_from_tray(tr::now);
|
: tr::lng_enable_notifications_from_tray(tr::now);
|
||||||
|
|
||||||
if (Platform::IsLinux()) {
|
if (Platform::IsLinux() && !Platform::IsWayland()) {
|
||||||
trayIconMenu->addAction(tr::lng_open_from_tray(tr::now), this, SLOT(showFromTray()));
|
trayIconMenu->addAction(tr::lng_open_from_tray(tr::now), this, SLOT(showFromTray()));
|
||||||
}
|
}
|
||||||
trayIconMenu->addAction(tr::lng_minimize_to_tray(tr::now), this, SLOT(minimizeToTray()));
|
trayIconMenu->addAction(tr::lng_minimize_to_tray(tr::now), this, SLOT(minimizeToTray()));
|
||||||
|
@ -596,12 +596,12 @@ void MainWindow::updateTrayMenu(bool force) {
|
||||||
if (!trayIconMenu || (Platform::IsWindows() && !force)) return;
|
if (!trayIconMenu || (Platform::IsWindows() && !force)) return;
|
||||||
|
|
||||||
auto actions = trayIconMenu->actions();
|
auto actions = trayIconMenu->actions();
|
||||||
if (Platform::IsLinux()) {
|
if (Platform::IsLinux() && !Platform::IsWayland()) {
|
||||||
auto minimizeAction = actions.at(1);
|
auto minimizeAction = actions.at(1);
|
||||||
minimizeAction->setEnabled(isVisible());
|
minimizeAction->setEnabled(isVisible());
|
||||||
} else {
|
} else {
|
||||||
updateIsActive(0);
|
updateIsActive(0);
|
||||||
auto active = isActive();
|
auto active = Platform::IsWayland() ? isVisible() : isActive();
|
||||||
auto toggleAction = actions.at(0);
|
auto toggleAction = actions.at(0);
|
||||||
disconnect(toggleAction, SIGNAL(triggered(bool)), this, SLOT(minimizeToTray()));
|
disconnect(toggleAction, SIGNAL(triggered(bool)), this, SLOT(minimizeToTray()));
|
||||||
disconnect(toggleAction, SIGNAL(triggered(bool)), this, SLOT(showFromTray()));
|
disconnect(toggleAction, SIGNAL(triggered(bool)), this, SLOT(showFromTray()));
|
||||||
|
@ -610,7 +610,7 @@ void MainWindow::updateTrayMenu(bool force) {
|
||||||
? tr::lng_minimize_to_tray(tr::now)
|
? tr::lng_minimize_to_tray(tr::now)
|
||||||
: tr::lng_open_from_tray(tr::now));
|
: tr::lng_open_from_tray(tr::now));
|
||||||
}
|
}
|
||||||
auto notificationAction = actions.at(Platform::IsLinux() ? 2 : 1);
|
auto notificationAction = actions.at(Platform::IsLinux() && !Platform::IsWayland() ? 2 : 1);
|
||||||
auto notificationActionText = Global::DesktopNotify()
|
auto notificationActionText = Global::DesktopNotify()
|
||||||
? tr::lng_disable_notifications_from_tray(tr::now)
|
? tr::lng_disable_notifications_from_tray(tr::now)
|
||||||
: tr::lng_enable_notifications_from_tray(tr::now);
|
: tr::lng_enable_notifications_from_tray(tr::now);
|
||||||
|
@ -735,7 +735,7 @@ void MainWindow::handleTrayIconActication(
|
||||||
updateTrayMenu(true);
|
updateTrayMenu(true);
|
||||||
QTimer::singleShot(1, this, SLOT(psShowTrayMenu()));
|
QTimer::singleShot(1, this, SLOT(psShowTrayMenu()));
|
||||||
} else if (!skipTrayClick()) {
|
} else if (!skipTrayClick()) {
|
||||||
if (isActive()) {
|
if (Platform::IsWayland() ? isVisible() : isActive()) {
|
||||||
minimizeToTray();
|
minimizeToTray();
|
||||||
} else {
|
} else {
|
||||||
showFromTray(reason);
|
showFromTray(reason);
|
||||||
|
|
Loading…
Add table
Reference in a new issue