diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index 853baa8e8..3989a8eca 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -352,11 +352,18 @@ void WindowManager::initialize(Settings &settings, Paths &paths) settings.collpseMessagesMinLines.connect( [this](auto, auto) { this->forceLayoutChannelViews(); }); + // timer for periodically saving tabs + QObject::connect(&this->saveTimer_, &QTimer::timeout, + [=] { this->save(); }); + this->saveTimer_.start(60 * 1000); + this->initialized_ = true; } void WindowManager::save() { + log("[WindowManager] Saving"); + assertInGuiThread(); auto app = getApp(); diff --git a/src/singletons/WindowManager.hpp b/src/singletons/WindowManager.hpp index 74149876e..9f3fb9361 100644 --- a/src/singletons/WindowManager.hpp +++ b/src/singletons/WindowManager.hpp @@ -75,6 +75,8 @@ private: MessageElementFlags wordFlags_{}; pajlada::Settings::SettingListener wordFlagsListener_; + + QTimer saveTimer_; }; } // namespace chatterino