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

Add "Respect the Focus settings" on Windows.

This commit is contained in:
John Preston
2024-10-17 12:58:05 +04:00
parent e6af33367e
commit 285c96fd2e
5 changed files with 47 additions and 4 deletions

View File

@@ -864,6 +864,27 @@ NotifyViewCheckboxes SetupNotifyViewOptions(
void SetupAdvancedNotifications(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
if (Platform::IsWindows()) {
const auto skipInFocus = container->add(object_ptr<Button>(
container,
tr::lng_settings_skip_in_focus(),
st::settingsButtonNoIcon
))->toggleOn(rpl::single(Core::App().settings().skipToastsInFocus()));
skipInFocus->toggledChanges(
) | rpl::filter([](bool checked) {
return (checked != Core::App().settings().skipToastsInFocus());
}) | rpl::start_with_next([=](bool checked) {
Core::App().settings().setSkipToastsInFocus(checked);
Core::App().saveSettingsDelayed();
if (checked && Platform::Notifications::SkipToastForCustom()) {
using Change = Window::Notifications::ChangeType;
Core::App().notifications().notifySettingsChanged(
Change::DesktopEnabled);
}
}, skipInFocus->lifetime());
}
Ui::AddSkip(container, st::settingsCheckboxesSkip);
Ui::AddDivider(container);
Ui::AddSkip(container, st::settingsCheckboxesSkip);