Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSIX: hide the "Run at Startup" option if running as packaged #1174

Merged
merged 1 commit into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.