2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Add a checkbox to disable taskbar flash.

Also add ability to set urgent flag for the window on Linux.

Fixes #223, fixes #897, fixes #906.
This commit is contained in:
John Preston
2020-05-12 14:04:53 +04:00
parent f4f6550d66
commit 6f760d513e
15 changed files with 86 additions and 48 deletions

View File

@@ -757,7 +757,8 @@ void MainWindow::toggleDisplayNotifyFromTray() {
return;
}
bool soundNotifyChanged = false;
auto soundNotifyChanged = false;
auto flashBounceNotifyChanged = false;
Global::SetDesktopNotify(!Global::DesktopNotify());
if (Global::DesktopNotify()) {
if (Global::RestoreSoundNotifyFromTray() && !Global::SoundNotify()) {
@@ -765,6 +766,12 @@ void MainWindow::toggleDisplayNotifyFromTray() {
Global::SetRestoreSoundNotifyFromTray(false);
soundNotifyChanged = true;
}
if (Global::RestoreFlashBounceNotifyFromTray()
&& !Global::FlashBounceNotify()) {
Global::SetFlashBounceNotify(true);
Global::SetRestoreFlashBounceNotifyFromTray(false);
flashBounceNotifyChanged = true;
}
} else {
if (Global::SoundNotify()) {
Global::SetSoundNotify(false);
@@ -773,13 +780,23 @@ void MainWindow::toggleDisplayNotifyFromTray() {
} else {
Global::SetRestoreSoundNotifyFromTray(false);
}
if (Global::FlashBounceNotify()) {
Global::SetFlashBounceNotify(false);
Global::SetRestoreFlashBounceNotifyFromTray(true);
flashBounceNotifyChanged = true;
} else {
Global::SetRestoreFlashBounceNotifyFromTray(false);
}
}
Local::writeUserSettings();
account().session().notifications().settingsChanged().notify(
Window::Notifications::ChangeType::DesktopEnabled);
using Change = Window::Notifications::ChangeType;
auto &changes = account().session().notifications().settingsChanged();
changes.notify(Change::DesktopEnabled);
if (soundNotifyChanged) {
account().session().notifications().settingsChanged().notify(
Window::Notifications::ChangeType::SoundEnabled);
changes.notify(Change::SoundEnabled);
}
if (flashBounceNotifyChanged) {
changes.notify(Change::FlashBounceEnabled);
}
}