[Improvement] Allow to disable notification sound from tray
This commit is contained in:
parent
ae26dbe21b
commit
4550452c73
3 changed files with 23 additions and 0 deletions
|
|
@ -79,6 +79,8 @@
|
|||
"ktg_settings_external_video_player": "External video player",
|
||||
"ktg_settings_external_video_player_about": "When this option is enabled, autoplay is force-disabled and system video player is used to play videos.",
|
||||
"ktg_settings_adaptive_bubbles": "Adaptive bubbles",
|
||||
"ktg_settings_disable_sound_from_tray": "Disable sound",
|
||||
"ktg_settings_enable_sound_from_tray": "Enable sound",
|
||||
"ktg_settings_recent_stickers_limit": {
|
||||
"zero": "Recent stickers: show {count} stickers",
|
||||
"one": "Recent stickers: show {count} sticker",
|
||||
|
|
|
|||
|
|
@ -91,6 +91,17 @@ void Tray::rebuildMenu() {
|
|||
_tray.addAction(
|
||||
std::move(notificationsText),
|
||||
[=] { toggleSoundNotifications(); });
|
||||
|
||||
auto soundText = _textUpdates.events(
|
||||
) | rpl::map([=] {
|
||||
return Core::App().settings().soundNotify()
|
||||
? ktr("ktg_settings_disable_sound_from_tray")
|
||||
: ktr("ktg_settings_enable_sound_from_tray");
|
||||
});
|
||||
|
||||
_tray.addAction(
|
||||
std::move(soundText),
|
||||
[=] { toggleSound(); });
|
||||
}
|
||||
|
||||
_tray.addAction(rktr("ktg_quit_from_tray"), [] { Core::Quit(); });
|
||||
|
|
@ -136,6 +147,15 @@ rpl::producer<> Tray::hideToTrayRequests() const {
|
|||
}
|
||||
}
|
||||
|
||||
void Tray::toggleSound() {
|
||||
auto &settings = Core::App().settings();
|
||||
settings.setSoundNotify(!settings.soundNotify());
|
||||
Core::App().saveSettingsDelayed();
|
||||
using Change = Window::Notifications::ChangeType;
|
||||
auto ¬ifications = Core::App().notifications();
|
||||
notifications.notifySettingsChanged(Change::SoundEnabled);
|
||||
}
|
||||
|
||||
void Tray::toggleSoundNotifications() {
|
||||
auto soundNotifyChanged = false;
|
||||
auto flashBounceNotifyChanged = false;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public:
|
|||
|
||||
private:
|
||||
void rebuildMenu();
|
||||
void toggleSound();
|
||||
void toggleSoundNotifications();
|
||||
|
||||
Platform::Tray _tray;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue