mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
MSIX: hide the "Run at Startup" option if running as packaged
This commit is contained in:
parent
ee8893a884
commit
ca203435d1
@ -6,6 +6,7 @@
|
|||||||
#include <common/settings_helpers.h>
|
#include <common/settings_helpers.h>
|
||||||
#include "powertoy_module.h"
|
#include "powertoy_module.h"
|
||||||
#include <common/windows_colors.h>
|
#include <common/windows_colors.h>
|
||||||
|
#include <common/winstore.h>
|
||||||
|
|
||||||
static std::wstring settings_theme = L"system";
|
static std::wstring settings_theme = L"system";
|
||||||
static bool run_as_elevated = false;
|
static bool run_as_elevated = false;
|
||||||
@ -25,6 +26,10 @@ json::JsonObject load_general_settings()
|
|||||||
json::JsonObject get_general_settings()
|
json::JsonObject get_general_settings()
|
||||||
{
|
{
|
||||||
json::JsonObject result;
|
json::JsonObject result;
|
||||||
|
|
||||||
|
const bool packaged = running_as_packaged();
|
||||||
|
result.SetNamedValue(L"packaged", json::value(packaged));
|
||||||
|
|
||||||
const bool startup = is_auto_start_task_active_for_this_user();
|
const bool startup = is_auto_start_task_active_for_this_user();
|
||||||
result.SetNamedValue(L"startup", json::value(startup));
|
result.SetNamedValue(L"startup", json::value(startup));
|
||||||
|
|
||||||
@ -50,7 +55,7 @@ void apply_general_settings(const json::JsonObject& general_configs)
|
|||||||
{
|
{
|
||||||
const bool startup = general_configs.GetNamedBoolean(L"startup");
|
const bool startup = general_configs.GetNamedBoolean(L"startup");
|
||||||
const bool current_startup = is_auto_start_task_active_for_this_user();
|
const bool current_startup = is_auto_start_task_active_for_this_user();
|
||||||
if (current_startup != startup)
|
if (!running_as_packaged() && current_startup != startup)
|
||||||
{
|
{
|
||||||
if (startup)
|
if (startup)
|
||||||
{
|
{
|
||||||
|
@ -121,11 +121,14 @@ export class GeneralSettings extends React.Component <any, any> {
|
|||||||
}
|
}
|
||||||
<Separator />
|
<Separator />
|
||||||
<Text variant='xLarge'>General</Text>
|
<Text variant='xLarge'>General</Text>
|
||||||
<BoolToggleSettingsControl
|
{!this.state.settings.general.packaged &&
|
||||||
setting={{display_name: 'Run at Startup', value: this.state.settings.general.startup}}
|
(
|
||||||
on_change={this.parent_on_change}
|
<BoolToggleSettingsControl
|
||||||
ref={(input) => {this.startup_reference=input;}}
|
setting={{display_name: 'Run at Startup', value: this.state.settings.general.startup}}
|
||||||
/>
|
on_change={this.parent_on_change}
|
||||||
|
ref={(input) => {this.startup_reference=input;}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<BoolToggleSettingsControl
|
<BoolToggleSettingsControl
|
||||||
setting={{display_name: 'Always run as administrator', value: this.state.settings.general.run_elevated}}
|
setting={{display_name: 'Always run as administrator', value: this.state.settings.general.run_elevated}}
|
||||||
on_change={this.parent_on_change}
|
on_change={this.parent_on_change}
|
||||||
|
2
src/settings/settings-html/dist/bundle.js
vendored
2
src/settings/settings-html/dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user