[feat] add daemon support with automatic restart on crash

This commit is contained in:
dijunkun
2025-11-19 22:09:51 +08:00
parent 4dd3c3e073
commit 97ab9bfca5
11 changed files with 549 additions and 7 deletions

View File

@@ -252,6 +252,25 @@ int Render::SettingWindow() {
ImGui::SetCursorPosY(settings_items_offset);
ImGui::Checkbox("##enable_autostart_", &enable_autostart_);
}
ImGui::Separator();
{
settings_items_offset += settings_items_padding;
ImGui::SetCursorPosY(settings_items_offset + 4);
ImGui::Text(
"%s",
localization::enable_daemon[localization_language_index_].c_str());
if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) {
ImGui::SetCursorPosX(ENABLE_DAEMON_PADDING_CN);
} else {
ImGui::SetCursorPosX(ENABLE_DAEMON_PADDING_EN);
}
ImGui::SetCursorPosY(settings_items_offset);
ImGui::Checkbox("##enable_daemon_", &enable_daemon_);
}
#if _WIN32
ImGui::Separator();
@@ -373,6 +392,13 @@ int Render::SettingWindow() {
}
enable_autostart_last_ = enable_autostart_;
if (enable_daemon_) {
config_center_->SetDaemon(true);
} else {
config_center_->SetDaemon(false);
}
enable_daemon_last_ = enable_daemon_;
#if _WIN32
if (enable_minimize_to_tray_) {
config_center_->SetMinimizeToTray(true);