Skip to content

Commit

Permalink
MSIX: hide the "Run at Startup" option if running as packaged
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe committed Jan 29, 2020
1 parent ee8893a commit ca20343
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/runner/general_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <common/settings_helpers.h>
#include "powertoy_module.h"
#include <common/windows_colors.h>
#include <common/winstore.h>

static std::wstring settings_theme = L"system";
static bool run_as_elevated = false;
Expand All @@ -25,6 +26,10 @@ json::JsonObject load_general_settings()
json::JsonObject get_general_settings()
{
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();
result.SetNamedValue(L"startup", json::value(startup));

Expand All @@ -50,7 +55,7 @@ void apply_general_settings(const json::JsonObject& general_configs)
{
const bool startup = general_configs.GetNamedBoolean(L"startup");
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)
{
Expand Down
13 changes: 8 additions & 5 deletions src/settings-web/src/components/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ export class GeneralSettings extends React.Component <any, any> {
}
<Separator />
<Text variant='xLarge'>General</Text>
<BoolToggleSettingsControl
setting={{display_name: 'Run at Startup', value: this.state.settings.general.startup}}
on_change={this.parent_on_change}
ref={(input) => {this.startup_reference=input;}}
/>
{!this.state.settings.general.packaged &&
(
<BoolToggleSettingsControl
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
setting={{display_name: 'Always run as administrator', value: this.state.settings.general.run_elevated}}
on_change={this.parent_on_change}
Expand Down
2 changes: 1 addition & 1 deletion src/settings/settings-html/dist/bundle.js

Large diffs are not rendered by default.

0 comments on commit ca20343

Please sign in to comment.