mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
Sync run on startup with actual task scheduler (#14723)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
// TODO: would be nice to get rid of these globals, since they're basically cached json settings
|
||||
static std::wstring settings_theme = L"system";
|
||||
static bool startup_disabled_manually = false;
|
||||
static bool run_as_elevated = false;
|
||||
static bool download_updates_automatically = true;
|
||||
|
||||
@@ -91,7 +92,20 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
|
||||
if (json::has(general_configs, L"startup", json::JsonValueType::Boolean))
|
||||
{
|
||||
const bool startup = general_configs.GetNamedBoolean(L"startup");
|
||||
if (startup)
|
||||
|
||||
auto settings = get_general_settings();
|
||||
static std::once_flag once_flag;
|
||||
std::call_once(once_flag, [settings, startup, general_configs] {
|
||||
if (json::has(general_configs, L"startup", json::JsonValueType::Boolean))
|
||||
{
|
||||
if (startup == true && settings.isStartupEnabled == false)
|
||||
{
|
||||
startup_disabled_manually = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (startup && !startup_disabled_manually)
|
||||
{
|
||||
if (is_process_elevated())
|
||||
{
|
||||
@@ -117,6 +131,7 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
|
||||
else
|
||||
{
|
||||
delete_auto_start_task_for_this_user();
|
||||
startup_disabled_manually = false;
|
||||
}
|
||||
}
|
||||
if (json::has(general_configs, L"enabled"))
|
||||
|
||||
Reference in New Issue
Block a user