2019-05-03 00:29:04 +02:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
2021-03-16 00:15:25 +01:00
|
|
|
import "CascadiaSettings.idl";
|
|
|
|
|
|
|
|
namespace Microsoft.Terminal.Settings.Model
|
2019-05-03 00:29:04 +02:00
|
|
|
{
|
2021-04-09 00:46:16 +02:00
|
|
|
runtimeclass TerminalSettingsCreateResult
|
|
|
|
{
|
2021-04-21 22:35:06 +02:00
|
|
|
TerminalSettingsCreateResult(TerminalSettings defaultSettings);
|
2021-04-09 00:46:16 +02:00
|
|
|
TerminalSettings DefaultSettings { get; };
|
|
|
|
TerminalSettings UnfocusedSettings { get; };
|
|
|
|
}
|
|
|
|
|
2019-05-03 00:29:04 +02:00
|
|
|
// Class Description:
|
|
|
|
// TerminalSettings encapsulates all settings that control the
|
|
|
|
// TermControl's behavior. In these settings there is both the entirety
|
|
|
|
// of the Core ICoreSettings properties and the IControlSettings
|
|
|
|
// properties. It's the Profile's responsibility to build this from
|
|
|
|
// settings it contains, in combination with the global settings.
|
|
|
|
// The TerminalControl will pull settings it requires from this object,
|
|
|
|
// and pass along the Core properties to the terminal core.
|
|
|
|
[default_interface]
|
2021-03-17 21:47:24 +01:00
|
|
|
runtimeclass TerminalSettings : Microsoft.Terminal.Core.ICoreSettings,
|
|
|
|
Microsoft.Terminal.Control.IControlSettings
|
2019-05-03 00:29:04 +02:00
|
|
|
{
|
|
|
|
TerminalSettings();
|
2021-03-16 00:15:25 +01:00
|
|
|
|
Reintroduce the Defaults page and the Reset buttons (#10588)
This pull request brings back the "Base Layer" page, now renamed to
"Defaults", and the "Reset to inherited value" buttons. The scope of
inheritance for which buttons will display has been widened.
The button will be visible in the following cases:
The user has set a setting for the current profile, and it overrides...
1. ... something in profiles.defaults.
2. ... something in a Fragment Extension profile.
3. ... something from a Dynamic Profile Generator.
4. ... something from the compiled-in defaults.
Compared to the original implementation of reset arrows, cases (1), (3)
and (4) are new. Rationale:
(1) The user can see a setting on the Defaults page, and they need a way
to reset back to it.
(3) Dynamic profiles are not meaningfully different from fragments, and
users may need a way to reset back to the default value generated
for WSL or PowerShell.
(4) The user can see a setting on the Defaults page, **BUT** they are
not the one who created it. They *still* need a way to get back to
it.
To support this, I've introduced another origin tag, "User", and renamed
"Custom" to "None". Due to the way origin/override detection works¹, we
cannot otherwise disambiguate between settings that came from the user
and settings that came from the compiled-in defaults.
Changes were required in TerminalSettings such that we could construct a
settings object with a profile that does not have a GUID. In making this
change, I fixed a bit of silliness where we took a profile, extracted
its guid, and used that guid to look up the same profile object. Oops.
I also fixed the PropertyChanged notifier to include the
XxxOverrideSource property.
The presence of the page and the reset arrows is restricted to
Preview- or Dev-branded builds. Stable builds will retain their current
behavior.
¹ `XxxOverrideSource` returns the profile *above* the current profile
that holds a value for setting `Xxx`. When the value is the
compiled-in value, `XxxOverrideSource` will be `null`. Since it's
supposed to be the profile above the current profile, it will also be
`null` if the profile contains a setting at this layer.
In short, `null` means "user specified" *or* "compiled in". Oops.
Fixes #10430
Validation
----------
* [x] Tested Release build to make sure it's mostly arrow-free (apart from fragments)
2021-07-10 00:03:41 +02:00
|
|
|
static TerminalSettingsCreateResult CreateWithProfile(CascadiaSettings appSettings, Profile profile, Microsoft.Terminal.Control.IKeyBindings keybindings);
|
2021-04-09 00:46:16 +02:00
|
|
|
static TerminalSettingsCreateResult CreateWithNewTerminalArgs(CascadiaSettings appSettings, NewTerminalArgs newTerminalArgs, Microsoft.Terminal.Control.IKeyBindings keybindings);
|
2021-03-16 00:15:25 +01:00
|
|
|
|
|
|
|
void ApplyColorScheme(ColorScheme scheme);
|
Persist window layout on window close (#10972)
This commit adds initial support for saving window layout on application
close.
Done:
- Add user setting for if tabs should be maintained.
- Added events to track the number of open windows for the monarch, and
then save if you are the last window closing.
- Saves layout when the user explicitly hits the "Close Window" button.
- If the user manually closed all of their tabs (through the tab x
button or through closing all panes on the tab) then remove any saved
state.
- Saves in the ApplicationState file a list of actions the terminal can
perform to restore its layout and the window size/position
information.
- This saves an action to focus the correct pane, but this won't
actually work without #10978. Note that if you have a pane zoomed, it
does still zoom the correct pane, but when you unzoom it will have a
different pane selected.
Todo:
- multiple windows? Right now it can only handle loading/saving one
window.
- PR #11083 will save multiple windows.
- This also sometimes runs into the existing bug where multiple tabs
appear to be focused on opening.
Next Steps:
- The business logic of when the save is triggered can be adjusted as
necessary.
- Right now I am taking the pragmatic approach and just saving the state
as an array of objects, but only ever populate it with 1, that way
saving multiple windows in the future could be added without breaking
schema compatibility. Selfishly I'm hoping that handling multiple
windows could be spun off into another pr/feature for now.
- One possible thing that can maybe be done is that the commandline can
be augmented with a "--saved ##" attribute that would load from the
nth saved state if it exists. e.g. if there are 3 saved windows, on
first load it can spawn three wt --saved {0,1,2} that would reopen the
windows? This way there also exists a way to load a copy of a previous
window (if it is in the saved state).
- Is the application state something that is planned to be public/user
editable? In theory the user could since it is just json, but I don't
know what it buys them over just modifying their settings and
startupActions.
Validation Steps Performed:
- The happy path: open terminal -> set setting to true -> close terminal
-> reopen and see tabs. Tested with powershell/cmd/wsl windows.
- That closing all panes/tabs on their own will remove the saved
session.
- Open multiple windows, close windows and confirm that the last window
closed saves its state.
The generated file stores a sequence of actions that will be executed to
restore the terminal to its saved form.
References #8324
This is also one of the items on microsoft/terminal#5000
Closes #766
2021-09-09 00:44:53 +02:00
|
|
|
|
|
|
|
ColorScheme AppliedColorScheme;
|
2021-09-23 22:45:25 +02:00
|
|
|
|
2021-11-10 18:32:31 +01:00
|
|
|
// The getters for these are already defined in IControlSettings. So
|
|
|
|
// we're just adding the setters here, because TerminalApp likes to be
|
|
|
|
// able to change these at runtime (e.g. when duplicating a pane).
|
2021-09-23 22:45:25 +02:00
|
|
|
String Commandline { set; };
|
|
|
|
String StartingDirectory { set; };
|
|
|
|
String EnvironmentVariables { set; };
|
2019-05-03 00:29:04 +02:00
|
|
|
};
|
|
|
|
}
|