diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index 3353907261..9289ee1648 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -47,7 +47,6 @@ base::options::toggle OptionDeadlockDetector({ .id = kOptionDeadlockDetector, .name = "Deadlock Detector", .description = "Check once every 30 seconds that main thread is still responsive.", - .restartRequired = true, }); } // namespace @@ -200,10 +199,16 @@ void Sandbox::launchApplication() { } setupScreenScale(); - if (OptionDeadlockDetector.value()) { + rpl::single( + rpl::empty + ) | rpl::then( + OptionDeadlockDetector.changes() + ) | rpl::on_next([=] { using DeadlockDetector::PingThread; - _deadlockDetector = std::make_unique(this); - } + _deadlockDetector = OptionDeadlockDetector.value() + ? std::make_unique(this) + : nullptr; + }, _lifetime); _application = std::make_unique(); diff --git a/Telegram/SourceFiles/core/sandbox.h b/Telegram/SourceFiles/core/sandbox.h index 65cbaaa9a7..3a43b889de 100644 --- a/Telegram/SourceFiles/core/sandbox.h +++ b/Telegram/SourceFiles/core/sandbox.h @@ -135,6 +135,8 @@ private: std::unique_ptr _deadlockDetector; + rpl::lifetime _lifetime; + }; } // namespace Core diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 7147363441..7340567dd0 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -332,9 +332,7 @@ void Create(Window::Notifications::System *system) { Manager::Private::Private(not_null manager) : _manager(manager) -, _application(UseGNotification() - ? Gio::Application::get_default() - : nullptr) +, _application(Gio::Application::get_default()) , _sounds(cWorkingDir() + u"tdata/audio_cache"_q) { const auto &serverInformation = CurrentServerInformation; @@ -429,7 +427,7 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { _proxy = proxy; _interface = proxy; - if (_application || !_interface) { + if (!_interface) { return; } @@ -535,7 +533,7 @@ void Manager::Private::showNotification( .contextId = key, .msgId = info.itemId, }; - auto notification = _application + auto notification = UseGNotification() ? Gio::Notification::new_(info.title.toStdString()) : Gio::Notification(); diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 27c0201840..19603878dc 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -149,7 +149,6 @@ base::options::toggle OptionCustomNotification({ .scope = [] { return Platform::Notifications::Enforced(); }, - .restartRequired = true, }); const char kOptionGNotification[] = "gnotification"; @@ -168,7 +167,6 @@ base::options::toggle OptionGNotification({ return false; #endif // __has_include() }, - .restartRequired = true, }); base::options::toggle HideReplyButtonOption({ @@ -211,6 +209,13 @@ System::System() Core::App().domain().notifyUnreadBadgeChanged(); } }, lifetime()); + + rpl::merge( + OptionCustomNotification.changes(), + OptionGNotification.changes() + ) | rpl::on_next([=] { + createManager(); + }, lifetime()); } void System::createManager() {