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

Add "portable mode", where settings load from the install path #15051

Merged
merged 6 commits into from
Mar 31, 2023

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Mar 27, 2023

This pull request implements portable mode for Windows Terminal, which
will make side by side deployment of different versions generally more
feasible.

Portable mode was specified in #15032.

There are three broad categories of changes in this PR:

  1. Changes to settings loading.
  2. A new indicator in the settings UI plus a link to the portable mode
    docs.
  3. A new application display name, Terminal (Portable), which users
    will hopefully include in their bug reports.

It's surprisingly small for how big a deal it is!

Related to #15034
Closes #1386

std::filesystem::path GetBaseSettingsPath()
{
static auto baseSettingsPath = []() {
if (IsPortableMode())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this will always be false for IsPackaged, because nobody can put down the portable mode marker file. However... i should probably add a check for packaging to avoid a file lookup.

@zadjii-msft
Copy link
Member

Closes #1386?

@@ -822,7 +822,7 @@ try
// read settings.json from the Release stable file path if it exists.
// Otherwise use default settings file provided from original settings file
bool releaseSettingExists = false;
if (firstTimeSetup)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think this is the right choice. Every portable install starts anew.

@github-actions

This comment has been minimized.

HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock x:Uid="Settings_UnsavedSettingsWarning"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks pretty bad with both of these warnings visible at the same time, but... also the unsaved warning literally never shows up. It's disabled hard.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea we can workshop that if we ever get to doing the unsaved settings warning

@DHowett
Copy link
Member Author

DHowett commented Mar 27, 2023

I'll write up a more specific explanation of how both Unpackaged and Portable together close that issue and do it manually. Good call tho. :)

@DHowett
Copy link
Member Author

DHowett commented Mar 27, 2023

UI changes:
image

image

@DHowett
Copy link
Member Author

DHowett commented Mar 27, 2023

I actually did, in the end, choose to make this one close the "distribution methods" issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Area-Build Issues pertaining to the build system, CI, infrastructure, meta Product-Terminal The new Windows Terminal. labels Mar 27, 2023
@DHowett DHowett enabled auto-merge (squash) March 28, 2023 19:00
@DHowett DHowett disabled auto-merge March 28, 2023 19:03
@Jojoshua
Copy link

If this means we can have a direct download link from a microsoft website this could also close #7492

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like I really won out on this hostage exchange


namespace winrt::Microsoft::Terminal::Settings::Model
{
// Returns a path like C:\Users\<username>\AppData\Local\Packages\<packagename>\LocalState
// You can put your settings.json or state.json in this directory.
bool IsPortableMode()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so I'm clear here - if we start in portable mode, then I (a monster) go delete .portable while the Terminal is running, we'll keep using the portable settings and stay in portable mode, till we exit and relaunch the terminal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you open another Terminal process at this point, it'll still ask the monarch which window it should go into - either way, the original portable process would create the window, just as portable as before.

That tracks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if you (a monster) do that... it'll do that.

K, so.

It looks like two different launches from two different portable mode directories will do something ~ ~ weird ~ ~ and glom together (lol!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to fix in post, and I have a clever idea for it.

HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock x:Uid="Settings_UnsavedSettingsWarning"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea we can workshop that if we ever get to doing the unsaved settings warning

@DHowett DHowett changed the title Add a new "portable mode", where settings load from the install path Add "portable mode", where settings load from the install path Mar 31, 2023
@DHowett DHowett merged commit e6a3fa8 into main Mar 31, 2023
15 checks passed
@DHowett DHowett deleted the dev/duhowett/portable-mode branch March 31, 2023 22:12
@DHowett DHowett added this to To Cherry Pick in 1.17 Servicing Pipeline via automation Mar 31, 2023
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.17 Servicing Pipeline Mar 31, 2023
DHowett added a commit that referenced this pull request Mar 31, 2023
This pull request implements portable mode for Windows Terminal, which
will make side by side deployment of different versions generally more
feasible.

Portable mode was specified in #15032.

There are three broad categories of changes in this PR:

1. Changes to settings loading.
2. A new indicator in the settings UI plus a link to the portable mode
   docs.
3. A new application display name, `Terminal (Portable)`, which users
   will hopefully include in their bug reports.

It's surprisingly small for how big a deal it is!

Related to #15034
Closes #1386

(cherry picked from commit e6a3fa8)
Service-Card-Id: 88719279
Service-Version: 1.17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Build Issues pertaining to the build system, CI, infrastructure, meta Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
Development

Successfully merging this pull request may close these issues.

Investigate alternative deployment mechanisms for Windows Terminal
5 participants