terminal/src/cascadia/TerminalSettingsModel/TerminalSettings.idl
Mike Griese 546322b5c1
Enable previewing the color scheme in the command palette (#9794)
## Summary of the Pull Request

Allow schemes to be previewed as the user hovers over them in the Command Palette.

![preview-set-color-scheme](https://user-images.githubusercontent.com/18356694/114557761-9a3cbd80-9c2f-11eb-987f-eb0c89ee1fa6.gif)

## References
* Branched off of #8392, which is why the commit history is so polluted. 330a8e8 : 544b2fd has the interesting commits
* #5400: cmdpal megathread

### Potential follow-ups
* changing the font size
* changing the font face
* changing the opacity of acrylic

## PR Checklist
* [x] Closes #6689, a last straggling FHL PR
* [x] I work here
* [ ] Tests added/passed
* [n/a] Requires documentation to be updated - I don't think so

## Detailed Description of the Pull Request / Additional comments

This works by inserting a "preview" `TerminalSettings` into the settings hierarchy, before the `TermControl`'s runtime settings, and after the ones from the actual `CascadiaSettings`. This allows us to modify that preview settings object, then discard it when we're done with the preview.

This could also be used for other settings in the future - I built it to be extensible to other `ShortcutAction`s, though I haven't implemented those yet.

## Validation Steps Performed

* Select a colorscheme - it becomes the active one
* `colortool -x <scheme>` after selecting a scheme - colortool overrides the selected scheme
* Select a colorscheme after a `colortool -x <scheme>` after selecting a scheme - the scheme in the palette becomes the active one
* Pressing <kbd>esc</kbd> at any point to dismiss the command palette - scheme returns to the previous one
* reloading the settings - returns to the scheme in the settings
2021-04-21 20:35:06 +00:00

38 lines
1.7 KiB
Plaintext

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "CascadiaSettings.idl";
namespace Microsoft.Terminal.Settings.Model
{
runtimeclass TerminalSettingsCreateResult
{
TerminalSettingsCreateResult(TerminalSettings defaultSettings);
TerminalSettings DefaultSettings { get; };
TerminalSettings UnfocusedSettings { get; };
}
// 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]
runtimeclass TerminalSettings : Microsoft.Terminal.Core.ICoreSettings,
Microsoft.Terminal.Control.IControlSettings
{
TerminalSettings();
static TerminalSettingsCreateResult CreateWithProfileByID(CascadiaSettings appSettings, Guid profileGuid, Microsoft.Terminal.Control.IKeyBindings keybindings);
static TerminalSettingsCreateResult CreateWithNewTerminalArgs(CascadiaSettings appSettings, NewTerminalArgs newTerminalArgs, Microsoft.Terminal.Control.IKeyBindings keybindings);
static TerminalSettingsCreateResult CreateWithParent(TerminalSettingsCreateResult parent);
void SetParent(TerminalSettings parent);
TerminalSettings GetParent();
void ApplyColorScheme(ColorScheme scheme);
};
}