mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-06 14:19:45 +00:00
Compare commits
17 Commits
dev/lhecke
...
dev/migrie
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b73fa0091f | ||
|
|
b28e9c7530 | ||
|
|
3aa15c744b | ||
|
|
7856f3a135 | ||
|
|
b6eca90a87 | ||
|
|
052f717d6a | ||
|
|
3dd735e858 | ||
|
|
f516c5f7d6 | ||
|
|
34d2bcc29a | ||
|
|
e0c3d70186 | ||
|
|
373d8a2633 | ||
|
|
ab860e0ebc | ||
|
|
7cf505eea5 | ||
|
|
70ad4e2e26 | ||
|
|
c5f6fa3cfc | ||
|
|
5d238d6809 | ||
|
|
f6659268e0 |
@@ -72,6 +72,9 @@ namespace SettingsModelLocalTests
|
||||
TEST_METHOD(TestCloneInheritanceTree);
|
||||
TEST_METHOD(TestValidDefaults);
|
||||
TEST_METHOD(TestInheritedCommand);
|
||||
TEST_METHOD(DefaultQuakeWindowSettings);
|
||||
TEST_METHOD(LayeredWindowSettings);
|
||||
TEST_METHOD(LayeredOnDefaultWindowSettings);
|
||||
TEST_METHOD(LoadFragmentsWithMultipleUpdates);
|
||||
|
||||
private:
|
||||
@@ -241,7 +244,9 @@ namespace SettingsModelLocalTests
|
||||
const auto settings = createSettings(goodProfiles);
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(0), settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
const auto expected{ settings->WindowSettingsDefaults().DefaultProfile() };
|
||||
const auto actual{ settings->AllProfiles().GetAt(0).Guid() };
|
||||
VERIFY_ARE_EQUAL(expected, actual);
|
||||
}
|
||||
{
|
||||
// Case 2: Bad settings
|
||||
@@ -252,7 +257,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingDefaultProfile, settings->Warnings().GetAt(0));
|
||||
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
}
|
||||
{
|
||||
// Case 2: Bad settings
|
||||
@@ -263,7 +268,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingDefaultProfile, settings->Warnings().GetAt(0));
|
||||
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
}
|
||||
{
|
||||
// Case 4: Good settings, default profile is a string
|
||||
@@ -272,7 +277,7 @@ namespace SettingsModelLocalTests
|
||||
const auto settings = createSettings(goodProfilesSpecifiedByName);
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(0), settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(1).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(1).Guid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +365,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingDefaultProfile, settings->Warnings().GetAt(1));
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().GetAt(0).Guid(), settings->GlobalSettings().DefaultProfile());
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().GetAt(0).Guid(), settings->WindowSettingsDefaults().DefaultProfile());
|
||||
}
|
||||
|
||||
void DeserializationTests::LayerGlobalProperties()
|
||||
@@ -382,10 +387,10 @@ namespace SettingsModelLocalTests
|
||||
})" };
|
||||
|
||||
const auto settings = winrt::make_self<implementation::CascadiaSettings>(userSettings, inboxSettings);
|
||||
VERIFY_ARE_EQUAL(true, settings->GlobalSettings().AlwaysShowTabs());
|
||||
VERIFY_ARE_EQUAL(240, settings->GlobalSettings().InitialCols());
|
||||
VERIFY_ARE_EQUAL(60, settings->GlobalSettings().InitialRows());
|
||||
VERIFY_ARE_EQUAL(false, settings->GlobalSettings().ShowTabsInTitlebar());
|
||||
VERIFY_ARE_EQUAL(true, settings->WindowSettingsDefaults().AlwaysShowTabs());
|
||||
VERIFY_ARE_EQUAL(240, settings->WindowSettingsDefaults().InitialCols());
|
||||
VERIFY_ARE_EQUAL(60, settings->WindowSettingsDefaults().InitialRows());
|
||||
VERIFY_ARE_EQUAL(false, settings->WindowSettingsDefaults().ShowTabsInTitlebar());
|
||||
}
|
||||
|
||||
void DeserializationTests::ValidateProfileOrdering()
|
||||
@@ -546,7 +551,6 @@ namespace SettingsModelLocalTests
|
||||
})" };
|
||||
|
||||
const auto settings = winrt::make_self<implementation::CascadiaSettings>(settings0String, DefaultJson);
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(4u, settings->AllProfiles().Size());
|
||||
VERIFY_IS_TRUE(settings->AllProfiles().GetAt(0).HasGuid());
|
||||
@@ -1033,7 +1037,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_IS_NOT_NULL(settings->ProfileDefaults());
|
||||
|
||||
VERIFY_ARE_EQUAL(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}", settings->GlobalSettings().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}", settings->WindowSettingsDefaults().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(2u, settings->AllProfiles().Size());
|
||||
|
||||
VERIFY_ARE_EQUAL(2345, settings->AllProfiles().GetAt(0).HistorySize());
|
||||
@@ -1071,7 +1075,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto settings = winrt::make_self<implementation::CascadiaSettings>(settings0String, DefaultJson);
|
||||
|
||||
VERIFY_ARE_EQUAL(guid1String, settings->GlobalSettings().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(guid1String, settings->WindowSettingsDefaults().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(4u, settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(guid1, settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_NOT_EQUAL(guid1, settings->AllProfiles().GetAt(1).Guid());
|
||||
@@ -1775,7 +1779,7 @@ namespace SettingsModelLocalTests
|
||||
const auto copyImpl{ winrt::get_self<implementation::CascadiaSettings>(copy) };
|
||||
|
||||
// test globals
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), copyImpl->GlobalSettings().DefaultProfile());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), copyImpl->WindowSettingsDefaults().DefaultProfile());
|
||||
|
||||
// test profiles
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().Size(), copyImpl->AllProfiles().Size());
|
||||
@@ -1793,9 +1797,9 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(nameMapOriginal.Size(), nameMapCopy.Size());
|
||||
|
||||
// Test that changing the copy should not change the original
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().WordDelimiters(), copyImpl->GlobalSettings().WordDelimiters());
|
||||
copyImpl->GlobalSettings().WordDelimiters(L"changed value");
|
||||
VERIFY_ARE_NOT_EQUAL(settings->GlobalSettings().WordDelimiters(), copyImpl->GlobalSettings().WordDelimiters());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().WordDelimiters(), copyImpl->WindowSettingsDefaults().WordDelimiters());
|
||||
copyImpl->WindowSettingsDefaults().WordDelimiters(L"changed value");
|
||||
VERIFY_ARE_NOT_EQUAL(settings->WindowSettingsDefaults().WordDelimiters(), copyImpl->WindowSettingsDefaults().WordDelimiters());
|
||||
}
|
||||
|
||||
void DeserializationTests::TestCloneInheritanceTree()
|
||||
@@ -1829,7 +1833,7 @@ namespace SettingsModelLocalTests
|
||||
const auto copyImpl{ winrt::get_self<implementation::CascadiaSettings>(copy) };
|
||||
|
||||
// test globals
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), copyImpl->GlobalSettings().DefaultProfile());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), copyImpl->WindowSettingsDefaults().DefaultProfile());
|
||||
|
||||
// test profiles
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().Size(), copyImpl->AllProfiles().Size());
|
||||
@@ -1989,6 +1993,139 @@ namespace SettingsModelLocalTests
|
||||
}
|
||||
}
|
||||
|
||||
void DeserializationTests::DefaultQuakeWindowSettings()
|
||||
{
|
||||
const auto settings{ winrt::make_self<implementation::CascadiaSettings>(DefaultJson, "") };
|
||||
VERIFY_ARE_EQUAL(0u, settings->AllWindowSettings().Size());
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettings(L"_quake") };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_EQUAL(LaunchMode::FocusMode, windowSettings.LaunchMode());
|
||||
}
|
||||
}
|
||||
|
||||
void DeserializationTests::LayeredWindowSettings()
|
||||
{
|
||||
static constexpr std::string_view settingsJson{ R"(
|
||||
{
|
||||
"defaultProfile": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
|
||||
"initialRows": 5,
|
||||
"initialCols": 15,
|
||||
"windows": [
|
||||
{
|
||||
"name": "test",
|
||||
"defaultProfile": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"initialRows": 25,
|
||||
}
|
||||
],
|
||||
"profiles": [
|
||||
{
|
||||
"name": "profile0",
|
||||
"guid": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
|
||||
"historySize": 1,
|
||||
"commandline": "cmd.exe"
|
||||
},
|
||||
{
|
||||
"name": "profile1",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"historySize": 2,
|
||||
"commandline": "cmd.exe"
|
||||
}
|
||||
]
|
||||
})" };
|
||||
|
||||
const auto settings{ winrt::make_self<implementation::CascadiaSettings>(settingsJson, DefaultJson) };
|
||||
|
||||
VERIFY_ARE_EQUAL(1u, settings->AllWindowSettings().Size());
|
||||
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettingsDefaults() };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_EQUAL(5, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
}
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettings(L"test") };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_NOT_EQUAL(settings->WindowSettingsDefaults(), windowSettings);
|
||||
VERIFY_ARE_EQUAL(25, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
}
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettings(L"_quake") };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_NOT_EQUAL(settings->WindowSettingsDefaults(), windowSettings);
|
||||
// DebugBreak();
|
||||
VERIFY_ARE_EQUAL(5, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
VERIFY_ARE_EQUAL(LaunchMode::FocusMode, windowSettings.LaunchMode());
|
||||
}
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettings(L"I sure don't exist") };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults(), windowSettings);
|
||||
VERIFY_ARE_EQUAL(5, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
}
|
||||
}
|
||||
|
||||
void DeserializationTests::LayeredOnDefaultWindowSettings()
|
||||
{
|
||||
static constexpr std::string_view settingsJson{ R"(
|
||||
{
|
||||
"defaultProfile": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
|
||||
"initialRows": 5,
|
||||
"initialCols": 15,
|
||||
"windows": [
|
||||
{
|
||||
"name": "_quake",
|
||||
"defaultProfile": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"initialRows": 25,
|
||||
}
|
||||
],
|
||||
"profiles": [
|
||||
{
|
||||
"name": "profile0",
|
||||
"guid": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
|
||||
"historySize": 1,
|
||||
"commandline": "cmd.exe"
|
||||
},
|
||||
{
|
||||
"name": "profile1",
|
||||
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
|
||||
"historySize": 2,
|
||||
"commandline": "cmd.exe"
|
||||
}
|
||||
]
|
||||
})" };
|
||||
|
||||
const auto settings{ winrt::make_self<implementation::CascadiaSettings>(settingsJson, DefaultJson) };
|
||||
|
||||
VERIFY_ARE_EQUAL(1u, settings->AllWindowSettings().Size());
|
||||
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettingsDefaults() };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_EQUAL(5, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
}
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettings(L"_quake") };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_NOT_EQUAL(settings->WindowSettingsDefaults(), windowSettings);
|
||||
VERIFY_ARE_EQUAL(25, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
// The user didn't specify a launch mode, but we defaulted to focus mode
|
||||
VERIFY_ARE_EQUAL(LaunchMode::FocusMode, windowSettings.LaunchMode());
|
||||
}
|
||||
{
|
||||
const auto& windowSettings{ settings->WindowSettings(L"I sure don't exist") };
|
||||
VERIFY_IS_NOT_NULL(windowSettings);
|
||||
VERIFY_ARE_EQUAL(5, windowSettings.InitialRows());
|
||||
VERIFY_ARE_EQUAL(15, windowSettings.InitialCols());
|
||||
}
|
||||
}
|
||||
|
||||
// This test ensures GH#11597, GH#12520 don't regress.
|
||||
void DeserializationTests::LoadFragmentsWithMultipleUpdates()
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings->Warnings().Size());
|
||||
|
||||
const auto& entries = settings->GlobalSettings().NewTabMenu();
|
||||
const auto& entries = settings->WindowSettingsDefaults().NewTabMenu();
|
||||
VERIFY_ARE_EQUAL(1u, entries.Size());
|
||||
VERIFY_ARE_EQUAL(winrt::Microsoft::Terminal::Settings::Model::NewTabMenuEntryType::RemainingProfiles, entries.GetAt(0).Type());
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings->Warnings().Size());
|
||||
|
||||
const auto& entries = settings->GlobalSettings().NewTabMenu();
|
||||
const auto& entries = settings->WindowSettingsDefaults().NewTabMenu();
|
||||
VERIFY_ARE_EQUAL(1u, entries.Size());
|
||||
}
|
||||
catch (const SettingsException& ex)
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace SettingsModelLocalTests
|
||||
END_TEST_CLASS()
|
||||
|
||||
TEST_METHOD(GlobalSettings);
|
||||
TEST_METHOD(WindowSettings);
|
||||
TEST_METHOD(Profile);
|
||||
TEST_METHOD(ColorScheme);
|
||||
TEST_METHOD(Actions);
|
||||
@@ -65,11 +66,42 @@ namespace SettingsModelLocalTests
|
||||
// written alphabetically.
|
||||
VERIFY_ARE_EQUAL(toString(json), toString(result));
|
||||
}
|
||||
|
||||
// Helper to remove the `$schema` property from a json object. We
|
||||
// populate that based off the local path to the settings file. Of
|
||||
// course, that's entirely unpredictable in tests. So cut it out before
|
||||
// we do any sort of roundtrip testing.
|
||||
static Json::Value removeSchema(Json::Value json)
|
||||
{
|
||||
// DebugBreak();
|
||||
if (json.isMember("$schema"))
|
||||
{
|
||||
json.removeMember("$schema");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
};
|
||||
|
||||
void SerializationTests::GlobalSettings()
|
||||
{
|
||||
static constexpr std::string_view globalsString{ R"(
|
||||
{
|
||||
"inputServiceWarning": true,
|
||||
"startOnUserLogin": false,
|
||||
"actions": []
|
||||
})" };
|
||||
|
||||
static constexpr std::string_view smallGlobalsString{ R"(
|
||||
{
|
||||
"actions": []
|
||||
})" };
|
||||
|
||||
RoundtripTest<implementation::GlobalAppSettings>(globalsString);
|
||||
RoundtripTest<implementation::GlobalAppSettings>(smallGlobalsString);
|
||||
}
|
||||
void SerializationTests::WindowSettings()
|
||||
{
|
||||
static constexpr std::string_view windowString{ R"(
|
||||
{
|
||||
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
|
||||
|
||||
@@ -78,7 +110,6 @@ namespace SettingsModelLocalTests
|
||||
"initialPosition": ",",
|
||||
"launchMode": "default",
|
||||
"alwaysOnTop": false,
|
||||
"inputServiceWarning": true,
|
||||
"copyOnSelect": false,
|
||||
"copyFormatting": "all",
|
||||
"wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
|
||||
@@ -89,7 +120,6 @@ namespace SettingsModelLocalTests
|
||||
"tabWidthMode": "equal",
|
||||
"tabSwitcherMode": "mru",
|
||||
|
||||
"startOnUserLogin": false,
|
||||
"theme": "system",
|
||||
"snapToGridOnResize": true,
|
||||
"disableAnimations": false,
|
||||
@@ -103,17 +133,15 @@ namespace SettingsModelLocalTests
|
||||
"experimental.rendering.forceFullRepaint": false,
|
||||
"experimental.rendering.software": false,
|
||||
|
||||
"actions": []
|
||||
})" };
|
||||
|
||||
static constexpr std::string_view smallGlobalsString{ R"(
|
||||
static constexpr std::string_view smallWindowString{ R"(
|
||||
{
|
||||
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
|
||||
"actions": []
|
||||
})" };
|
||||
|
||||
RoundtripTest<implementation::GlobalAppSettings>(globalsString);
|
||||
RoundtripTest<implementation::GlobalAppSettings>(smallGlobalsString);
|
||||
RoundtripTest<implementation::WindowSettings>(windowString);
|
||||
RoundtripTest<implementation::WindowSettings>(smallWindowString);
|
||||
}
|
||||
|
||||
void SerializationTests::Profile()
|
||||
@@ -264,10 +292,10 @@ namespace SettingsModelLocalTests
|
||||
// about the order they get re-serialized in, but the tests aren't
|
||||
// clever enough to compare the structure, only the literal string
|
||||
// itself. Feel free to change as needed.
|
||||
static constexpr std::string_view actionsString4B{ R"([
|
||||
{ "command": { "action": "findMatch", "direction": "prev" }, "keys": "ctrl+shift+r" },
|
||||
{ "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+d" }
|
||||
])" };
|
||||
// static constexpr std::string_view actionsString4B{ R"([
|
||||
// { "command": { "action": "adjustFontSize", "delta": 1.0 }, "keys": "ctrl+d" },
|
||||
// { "command": { "action": "findMatch", "direction": "prev" }, "keys": "ctrl+shift+r" }
|
||||
// ])" };
|
||||
|
||||
// command with name and icon and multiple key chords
|
||||
static constexpr std::string_view actionsString5{ R"([
|
||||
@@ -381,7 +409,10 @@ namespace SettingsModelLocalTests
|
||||
|
||||
Log::Comment(L"complex commands with key chords");
|
||||
RoundtripTest<implementation::ActionMap>(actionsString4A);
|
||||
RoundtripTest<implementation::ActionMap>(actionsString4B);
|
||||
// This one is entirely too fragile. Regardless of the order you parse
|
||||
// them in, they don't roundtrip in the same order.
|
||||
//
|
||||
// RoundtripTest<implementation::ActionMap>(actionsString4B);
|
||||
|
||||
Log::Comment(L"command with name and icon and multiple key chords");
|
||||
RoundtripTest<implementation::ActionMap>(actionsString5);
|
||||
@@ -480,7 +511,8 @@ namespace SettingsModelLocalTests
|
||||
const auto settings{ winrt::make_self<implementation::CascadiaSettings>(settingsString) };
|
||||
|
||||
const auto result{ settings->ToJson() };
|
||||
VERIFY_ARE_EQUAL(toString(VerifyParseSucceeded(settingsString)), toString(result));
|
||||
VERIFY_ARE_EQUAL(toString(removeSchema(VerifyParseSucceeded(settingsString))),
|
||||
toString(removeSchema(result)));
|
||||
}
|
||||
|
||||
void SerializationTests::LegacyFontSettings()
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace SettingsModelLocalTests
|
||||
NewTerminalArgs args;
|
||||
args.Commandline(testCase.input);
|
||||
|
||||
const auto profile = settings->GetProfileForArgs(args);
|
||||
const auto profile = settings->GetProfileForArgs(args, settings->WindowSettingsDefaults());
|
||||
VERIFY_IS_NOT_NULL(profile);
|
||||
|
||||
if (testCase.expected < 0)
|
||||
@@ -339,8 +339,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().TabTitle().empty());
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Profile().empty());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid0, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
@@ -361,8 +361,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_FALSE(realArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}", realArgs.TerminalArgs().Profile());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid1, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings.Commandline());
|
||||
@@ -383,8 +383,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_FALSE(realArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"profile1", realArgs.TerminalArgs().Profile());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid1, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings.Commandline());
|
||||
@@ -405,8 +405,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_FALSE(realArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"profile2", realArgs.TerminalArgs().Profile());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(profile2Guid, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings.Commandline());
|
||||
@@ -427,8 +427,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"foo.exe", realArgs.TerminalArgs().Commandline());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
// This action specified a command but no profile; it gets reassigned to the base profile
|
||||
VERIFY_ARE_EQUAL(settings->ProfileDefaults(), profile);
|
||||
@@ -451,8 +451,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(L"profile1", realArgs.TerminalArgs().Profile());
|
||||
VERIFY_ARE_EQUAL(L"foo.exe", realArgs.TerminalArgs().Commandline());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid1, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"foo.exe", termSettings.Commandline());
|
||||
@@ -471,8 +471,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().TabTitle().empty());
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Profile().empty());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid0, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
@@ -492,8 +492,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"c:\\foo", realArgs.TerminalArgs().StartingDirectory());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid0, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
@@ -515,8 +515,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(L"c:\\foo", realArgs.TerminalArgs().StartingDirectory());
|
||||
VERIFY_ARE_EQUAL(L"profile2", realArgs.TerminalArgs().Profile());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(profile2Guid, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings.Commandline());
|
||||
@@ -537,8 +537,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"bar", realArgs.TerminalArgs().TabTitle());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid0, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
@@ -560,8 +560,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(L"bar", realArgs.TerminalArgs().TabTitle());
|
||||
VERIFY_ARE_EQUAL(L"profile2", realArgs.TerminalArgs().Profile());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(profile2Guid, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings.Commandline());
|
||||
@@ -585,8 +585,8 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_ARE_EQUAL(L"bar", realArgs.TerminalArgs().TabTitle());
|
||||
VERIFY_ARE_EQUAL(L"profile1", realArgs.TerminalArgs().Profile());
|
||||
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, realArgs.TerminalArgs(), nullptr) };
|
||||
const auto profile{ settings->GetProfileForArgs(realArgs.TerminalArgs(), settings->WindowSettingsDefaults()) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr) };
|
||||
const auto termSettings = settingsStruct.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(guid1, profile.Guid());
|
||||
VERIFY_ARE_EQUAL(L"foo.exe", termSettings.Commandline());
|
||||
@@ -625,7 +625,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
try
|
||||
{
|
||||
auto terminalSettings{ TerminalSettings::CreateWithProfile(*settings, profile1, nullptr) };
|
||||
auto terminalSettings{ TerminalSettings::CreateWithProfile(*settings, settings->WindowSettingsDefaults(), profile1, nullptr) };
|
||||
VERIFY_ARE_NOT_EQUAL(nullptr, terminalSettings);
|
||||
VERIFY_ARE_EQUAL(1, terminalSettings.DefaultSettings().HistorySize());
|
||||
}
|
||||
@@ -636,7 +636,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
try
|
||||
{
|
||||
auto terminalSettings{ TerminalSettings::CreateWithProfile(*settings, profile2, nullptr) };
|
||||
auto terminalSettings{ TerminalSettings::CreateWithProfile(*settings, settings->WindowSettingsDefaults(), profile2, nullptr) };
|
||||
VERIFY_ARE_NOT_EQUAL(nullptr, terminalSettings);
|
||||
VERIFY_ARE_EQUAL(2, terminalSettings.DefaultSettings().HistorySize());
|
||||
}
|
||||
@@ -647,7 +647,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
try
|
||||
{
|
||||
const auto termSettings{ TerminalSettings::CreateWithNewTerminalArgs(*settings, nullptr, nullptr) };
|
||||
const auto termSettings{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), nullptr, nullptr) };
|
||||
VERIFY_ARE_NOT_EQUAL(nullptr, termSettings);
|
||||
VERIFY_ARE_EQUAL(1, termSettings.DefaultSettings().HistorySize());
|
||||
}
|
||||
@@ -683,10 +683,10 @@ namespace SettingsModelLocalTests
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(2u, settings->ActiveProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->ActiveProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->ActiveProfiles().GetAt(0).Guid());
|
||||
try
|
||||
{
|
||||
const auto termSettings{ TerminalSettings::CreateWithNewTerminalArgs(*settings, nullptr, nullptr) };
|
||||
const auto termSettings{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), nullptr, nullptr) };
|
||||
VERIFY_ARE_NOT_EQUAL(nullptr, termSettings);
|
||||
VERIFY_ARE_EQUAL(1, termSettings.DefaultSettings().HistorySize());
|
||||
}
|
||||
@@ -788,7 +788,7 @@ namespace SettingsModelLocalTests
|
||||
|
||||
const auto activeProfiles = settings->ActiveProfiles();
|
||||
const auto colorSchemes = settings->GlobalSettings().ColorSchemes();
|
||||
const auto currentTheme = settings->GlobalSettings().CurrentTheme();
|
||||
const auto currentTheme = settings->GlobalSettings().CurrentTheme(settings->WindowSettingsDefaults());
|
||||
const auto terminalSettings0 = createTerminalSettings(activeProfiles.GetAt(0), colorSchemes, currentTheme);
|
||||
const auto terminalSettings1 = createTerminalSettings(activeProfiles.GetAt(1), colorSchemes, currentTheme);
|
||||
const auto terminalSettings2 = createTerminalSettings(activeProfiles.GetAt(2), colorSchemes, currentTheme);
|
||||
@@ -827,58 +827,58 @@ namespace SettingsModelLocalTests
|
||||
{ // just a profile (profile wins)
|
||||
NewTerminalArgs args{};
|
||||
args.Profile(L"profile0");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"profile0", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{ // profile and command line -> no promotion (profile wins)
|
||||
NewTerminalArgs args{};
|
||||
args.Profile(L"profile0");
|
||||
args.Commandline(L"foo.exe");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"profile0", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{ // just a title -> it is propagated
|
||||
NewTerminalArgs args{};
|
||||
args.TabTitle(L"Analog Kid");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"Analog Kid", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{ // title and command line -> no promotion
|
||||
NewTerminalArgs args{};
|
||||
args.TabTitle(L"Digital Man");
|
||||
args.Commandline(L"foo.exe");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"Digital Man", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{ // just a commandline -> promotion
|
||||
NewTerminalArgs args{};
|
||||
args.Commandline(L"foo.exe");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"foo.exe", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
// various typesof commandline follow
|
||||
{
|
||||
NewTerminalArgs args{};
|
||||
args.Commandline(L"foo.exe bar");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"foo.exe", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{
|
||||
NewTerminalArgs args{};
|
||||
args.Commandline(L"\"foo exe.exe\" bar");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"foo exe.exe", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{
|
||||
NewTerminalArgs args{};
|
||||
args.Commandline(L"\"\" grand designs");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
{
|
||||
NewTerminalArgs args{};
|
||||
args.Commandline(L" imagine a man");
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, args, nullptr) };
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, settings->WindowSettingsDefaults(), args, nullptr) };
|
||||
VERIFY_ARE_EQUAL(L"", settingsStruct.DefaultSettings().StartingTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace SettingsModelLocalTests
|
||||
VERIFY_IS_NULL(bar.TabRow().Background());
|
||||
}
|
||||
|
||||
const auto currentTheme{ settings->GlobalSettings().CurrentTheme() };
|
||||
const auto currentTheme{ settings->GlobalSettings().CurrentTheme(settings->WindowSettingsDefaults()) };
|
||||
VERIFY_IS_NOT_NULL(currentTheme);
|
||||
VERIFY_ARE_EQUAL(L"system", currentTheme.Name());
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ Author(s):
|
||||
|
||||
// Manually include til after we include Windows.Foundation to give it winrt superpowers
|
||||
#include "til.h"
|
||||
#include <til/winrt.h>
|
||||
|
||||
// Common includes for most tests:
|
||||
#include "../../inc/conattrs.hpp"
|
||||
|
||||
@@ -1393,7 +1393,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"profile0", realArgs.TerminalArgs().Profile());
|
||||
VERIFY_IS_NULL(realArgs.TerminalArgs().Elevate());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(false, termSettings.Elevate());
|
||||
@@ -1415,7 +1415,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"profile1", realArgs.TerminalArgs().Profile());
|
||||
VERIFY_IS_NULL(realArgs.TerminalArgs().Elevate());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(true, termSettings.Elevate());
|
||||
@@ -1437,7 +1437,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(L"profile2", realArgs.TerminalArgs().Profile());
|
||||
VERIFY_IS_NULL(realArgs.TerminalArgs().Elevate());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(false, termSettings.Elevate());
|
||||
@@ -1461,7 +1461,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs.TerminalArgs().Elevate());
|
||||
VERIFY_IS_FALSE(realArgs.TerminalArgs().Elevate().Value());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(false, termSettings.Elevate());
|
||||
@@ -1484,7 +1484,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs.TerminalArgs().Elevate());
|
||||
VERIFY_IS_FALSE(realArgs.TerminalArgs().Elevate().Value());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(false, termSettings.Elevate());
|
||||
@@ -1507,7 +1507,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs.TerminalArgs().Elevate());
|
||||
VERIFY_IS_FALSE(realArgs.TerminalArgs().Elevate().Value());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(false, termSettings.Elevate());
|
||||
@@ -1531,7 +1531,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs.TerminalArgs().Elevate());
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Elevate().Value());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(true, termSettings.Elevate());
|
||||
@@ -1553,7 +1553,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs.TerminalArgs().Elevate());
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Elevate().Value());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(true, termSettings.Elevate());
|
||||
@@ -1576,7 +1576,7 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_IS_NOT_NULL(realArgs.TerminalArgs().Elevate());
|
||||
VERIFY_IS_TRUE(realArgs.TerminalArgs().Elevate().Value());
|
||||
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, settings.WindowSettingsDefaults(), realArgs.TerminalArgs(), nullptr);
|
||||
const auto termSettings = termSettingsResult.DefaultSettings();
|
||||
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings.Commandline());
|
||||
VERIFY_ARE_EQUAL(true, termSettings.Elevate());
|
||||
|
||||
@@ -1086,7 +1086,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
Log::Comment(L"Change the tab switch order to MRU switching");
|
||||
TestOnUIThread([&page]() {
|
||||
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
|
||||
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
|
||||
});
|
||||
|
||||
Log::Comment(L"Switch to the next MRU tab, which is the fourth tab");
|
||||
@@ -1132,7 +1132,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
Log::Comment(L"Change the tab switch order to in-order switching");
|
||||
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::InOrder);
|
||||
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::InOrder);
|
||||
|
||||
Log::Comment(L"Switch to the next in-order tab, which is the third tab");
|
||||
TestOnUIThread([&page]() {
|
||||
@@ -1144,7 +1144,7 @@ namespace TerminalAppLocalTests
|
||||
});
|
||||
|
||||
Log::Comment(L"Change the tab switch order to not use the tab switcher (which is in-order always)");
|
||||
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::Disabled);
|
||||
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::Disabled);
|
||||
|
||||
Log::Comment(L"Switch to the next in-order tab, which is the fourth tab");
|
||||
TestOnUIThread([&page]() {
|
||||
@@ -1202,7 +1202,7 @@ namespace TerminalAppLocalTests
|
||||
|
||||
Log::Comment(L"Change the tab switch order to MRU switching");
|
||||
TestOnUIThread([&page]() {
|
||||
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
|
||||
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
|
||||
});
|
||||
|
||||
Log::Comment(L"Select the tabs from 0 to 3");
|
||||
|
||||
@@ -926,7 +926,7 @@ namespace winrt::TerminalApp::implementation
|
||||
newTerminalArgs = NewTerminalArgs();
|
||||
}
|
||||
|
||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
|
||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings()) };
|
||||
|
||||
// Manually fill in the evaluated profile.
|
||||
newTerminalArgs.Profile(::Microsoft::Console::Utils::GuidToString(profile.Guid()));
|
||||
@@ -1085,7 +1085,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// use global default if query URL is unspecified
|
||||
if (queryUrl.empty())
|
||||
{
|
||||
queryUrl = _settings.GlobalSettings().SearchWebDefaultQueryUrl().c_str();
|
||||
queryUrl = _currentWindowSettings().SearchWebDefaultQueryUrl().c_str();
|
||||
}
|
||||
|
||||
constexpr std::wstring_view queryToken{ L"%s" };
|
||||
|
||||
@@ -188,7 +188,6 @@ namespace winrt::TerminalApp::implementation
|
||||
g_hTerminalAppProvider,
|
||||
"AppCreated",
|
||||
TraceLoggingDescription("Event emitted when the application is started"),
|
||||
TraceLoggingBool(_settings.GlobalSettings().ShowTabsInTitlebar(), "TabsInTitlebar"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
@@ -223,25 +222,30 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
_hasSettingsStartupActions = false;
|
||||
const auto startupActions = newSettings.GlobalSettings().StartupActions();
|
||||
if (!startupActions.empty())
|
||||
{
|
||||
_settingsAppArgs.FullResetState();
|
||||
// TODO! Try to handle startup actions. These should be per-window
|
||||
// settings. But I think here, we're parsing them on the initial
|
||||
// settings load. We need to handle these closer to when the
|
||||
// TerminalWindow is created, after teh name is assigned to it.
|
||||
|
||||
ExecuteCommandlineArgs args{ newSettings.GlobalSettings().StartupActions() };
|
||||
auto result = _settingsAppArgs.ParseArgs(args);
|
||||
if (result == 0)
|
||||
{
|
||||
_hasSettingsStartupActions = true;
|
||||
// const auto startupActions = newSettings.GlobalSettings().StartupActions();
|
||||
// if (!startupActions.empty())
|
||||
// {
|
||||
// _settingsAppArgs.FullResetState();
|
||||
|
||||
// Validation also injects new-tab command if implicit new-tab was provided.
|
||||
_settingsAppArgs.ValidateStartupCommands();
|
||||
}
|
||||
else
|
||||
{
|
||||
_warnings.push_back(SettingsLoadWarnings::FailedToParseStartupActions);
|
||||
}
|
||||
}
|
||||
// ExecuteCommandlineArgs args{ newSettings.GlobalSettings().StartupActions() };
|
||||
// auto result = _settingsAppArgs.ParseArgs(args);
|
||||
// if (result == 0)
|
||||
// {
|
||||
// _hasSettingsStartupActions = true;
|
||||
|
||||
// // Validation also injects new-tab command if implicit new-tab was provided.
|
||||
// _settingsAppArgs.ValidateStartupCommands();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _warnings.push_back(SettingsLoadWarnings::FailedToParseStartupActions);
|
||||
// }
|
||||
// }
|
||||
|
||||
_settings = std::move(newSettings);
|
||||
|
||||
@@ -630,11 +634,6 @@ namespace winrt::TerminalApp::implementation
|
||||
return _settings.GlobalSettings().ActionMap().GlobalHotkeys();
|
||||
}
|
||||
|
||||
Microsoft::Terminal::Settings::Model::Theme AppLogic::Theme()
|
||||
{
|
||||
return _settings.GlobalSettings().CurrentTheme();
|
||||
}
|
||||
|
||||
bool AppLogic::IsolatedMode()
|
||||
{
|
||||
if (!_loadedInitialSettings)
|
||||
@@ -651,8 +650,12 @@ namespace winrt::TerminalApp::implementation
|
||||
ReloadSettings();
|
||||
}
|
||||
const auto& globals{ _settings.GlobalSettings() };
|
||||
return globals.AlwaysShowNotificationIcon() ||
|
||||
globals.MinimizeToNotificationArea();
|
||||
|
||||
// TODO! I'm pretty sure individual windows can already indicate somehow that they want a tray icon. We should fold the MinimizeToNotificationArea logic in with that.
|
||||
|
||||
return globals.AlwaysShowNotificationIcon() /* ||
|
||||
globals.MinimizeToNotificationArea()*/
|
||||
;
|
||||
}
|
||||
|
||||
bool AppLogic::AllowHeadless()
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
Windows::Foundation::Collections::IMapView<Microsoft::Terminal::Control::KeyChord, Microsoft::Terminal::Settings::Model::Command> GlobalHotkeys();
|
||||
|
||||
Microsoft::Terminal::Settings::Model::Theme Theme();
|
||||
bool IsolatedMode();
|
||||
bool AllowHeadless();
|
||||
bool RequestsTrayIcon();
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace TerminalApp
|
||||
void ReloadSettings();
|
||||
|
||||
// Selected settings to expose
|
||||
Microsoft.Terminal.Settings.Model.Theme Theme { get; };
|
||||
Boolean IsolatedMode { get; };
|
||||
Boolean AllowHeadless { get; };
|
||||
Boolean RequestsTrayIcon { get; };
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// Stash away the current requested theme of the app. We'll need that in
|
||||
// _BackgroundBrush() to do a theme-aware resource lookup
|
||||
_requestedTheme = settings.GlobalSettings().CurrentTheme().RequestedTheme();
|
||||
_requestedTheme = settings.GlobalSettings().CurrentTheme(settings.WindowSettingsDefaults()).RequestedTheme();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -66,14 +66,14 @@ namespace winrt::TerminalApp::implementation
|
||||
HRESULT TerminalPage::_OpenNewTab(const NewTerminalArgs& newTerminalArgs, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection)
|
||||
try
|
||||
{
|
||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
|
||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings()) };
|
||||
// GH#11114: GetProfileForArgs can return null if the index is higher
|
||||
// than the number of available profiles.
|
||||
if (!profile)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings) };
|
||||
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, _currentWindowSettings(), newTerminalArgs, *_bindings) };
|
||||
|
||||
// Try to handle auto-elevation
|
||||
if (_maybeElevate(newTerminalArgs, settings, profile))
|
||||
@@ -104,7 +104,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (insertPosition == -1)
|
||||
{
|
||||
insertPosition = _tabs.Size();
|
||||
if (_settings.GlobalSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
|
||||
if (_currentWindowSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
|
||||
{
|
||||
auto currentTabIndex = _GetFocusedTabIndex();
|
||||
if (currentTabIndex.has_value())
|
||||
@@ -249,7 +249,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Handle changes to the tab width set by the user
|
||||
void TerminalPage::_UpdateTabWidthMode()
|
||||
{
|
||||
_tabView.TabWidthMode(_settings.GlobalSettings().TabWidthMode());
|
||||
_tabView.TabWidthMode(_currentWindowSettings().TabWidthMode());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -260,9 +260,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// Show tabs when there's more than 1, or the user has chosen to always
|
||||
// show the tab bar.
|
||||
const auto isVisible = (!_isFullscreen && !_isInFocusMode) &&
|
||||
(_settings.GlobalSettings().ShowTabsInTitlebar() ||
|
||||
(_currentWindowSettings().ShowTabsInTitlebar() ||
|
||||
(_tabs.Size() > 1) ||
|
||||
_settings.GlobalSettings().AlwaysShowTabs());
|
||||
_currentWindowSettings().AlwaysShowTabs());
|
||||
|
||||
if (_tabView)
|
||||
{
|
||||
@@ -484,7 +484,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// 1. We want to customize this behavior (e.g., use MRU logic)
|
||||
// 2. In fullscreen (GH#5799) and focus (GH#7916) modes the _OnTabItemsChanged is not fired
|
||||
// 3. When rearranging tabs (GH#7916) _OnTabItemsChanged is suppressed
|
||||
const auto tabSwitchMode = _settings.GlobalSettings().TabSwitcherMode();
|
||||
const auto tabSwitchMode = _currentWindowSettings().TabSwitcherMode();
|
||||
|
||||
if (tabSwitchMode == TabSwitcherMode::MostRecentlyUsed)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_SelectNextTab(const bool bMoveRight, const Windows::Foundation::IReference<Microsoft::Terminal::Settings::Model::TabSwitcherMode>& customTabSwitcherMode)
|
||||
{
|
||||
const auto index{ _GetFocusedTabIndex().value_or(0) };
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _settings.GlobalSettings().TabSwitcherMode();
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _currentWindowSettings().TabSwitcherMode();
|
||||
if (tabSwitchMode == TabSwitcherMode::Disabled)
|
||||
{
|
||||
auto tabCount = _tabs.Size();
|
||||
@@ -942,7 +942,7 @@ namespace winrt::TerminalApp::implementation
|
||||
tab.TabViewItem().StartBringIntoView();
|
||||
|
||||
// Raise an event that our title changed
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar())
|
||||
if (_currentWindowSettings().ShowTitleInTitlebar())
|
||||
{
|
||||
_TitleChangedHandlers(*this, tab.Title());
|
||||
}
|
||||
@@ -961,7 +961,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void TerminalPage::_UpdateBackground(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile)
|
||||
{
|
||||
if (profile && _settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
if (profile && _currentWindowSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
_SetBackgroundImage(profile.DefaultAppearance());
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto tabRowImpl = winrt::get_self<implementation::TabRowControl>(_tabRow);
|
||||
_newTabButton = tabRowImpl->NewTabButton();
|
||||
|
||||
if (_settings.GlobalSettings().ShowTabsInTitlebar())
|
||||
if (_currentWindowSettings().ShowTabsInTitlebar())
|
||||
{
|
||||
// Remove the TabView from the page. We'll hang on to it, we need to
|
||||
// put it in the titlebar.
|
||||
@@ -211,7 +211,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// Initialize the state of the CloseButtonOverlayMode property of
|
||||
// our TabView, to match the tab.showCloseButton property in the theme.
|
||||
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
|
||||
if (const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()))
|
||||
{
|
||||
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : Settings::Model::TabCloseButtonVisibility::Always;
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Settings AllowDependentAnimations will affect whether animations are
|
||||
// enabled application-wide, so we don't need to check it each time we
|
||||
// want to create an animation.
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_settings.GlobalSettings().DisableAnimations());
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_currentWindowSettings().DisableAnimations());
|
||||
|
||||
// Once the page is actually laid out on the screen, trigger all our
|
||||
// startup actions. Things like Panes need to know at least how big the
|
||||
@@ -265,7 +265,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// _OnFirstLayout will remove this handler so it doesn't get called more than once.
|
||||
_layoutUpdatedRevoker = _tabContent.LayoutUpdated(winrt::auto_revoke, { this, &TerminalPage::_OnFirstLayout });
|
||||
|
||||
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
|
||||
_isAlwaysOnTop = _currentWindowSettings().AlwaysOnTop();
|
||||
|
||||
// DON'T set up Toasts/TeachingTips here. They should be loaded and
|
||||
// initialized the first time they're opened, in whatever method opens
|
||||
@@ -274,7 +274,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Setup mouse vanish attributes
|
||||
SystemParametersInfoW(SPI_GETMOUSEVANISH, 0, &_shouldMouseVanish, false);
|
||||
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _currentWindowSettings().ShowAdminShield());
|
||||
|
||||
// Store cursor, so we can restore it, e.g., after mouse vanishing
|
||||
// (we'll need to adapt this logic once we make cursor context aware)
|
||||
@@ -352,7 +352,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// It's possible that newTerminalArgs is null here.
|
||||
// GetProfileForArgs should be resilient to that.
|
||||
const auto profile{ settings.GetProfileForArgs(newTerminalArgs) };
|
||||
const auto profile{ settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings()) };
|
||||
if (profile.Elevate())
|
||||
{
|
||||
continue;
|
||||
@@ -778,7 +778,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Create profile entries from the NewTabMenu configuration using a
|
||||
// recursive helper function. This returns a std::vector of FlyoutItemBases,
|
||||
// that we then add to our Flyout.
|
||||
auto entries = _settings.GlobalSettings().NewTabMenu();
|
||||
auto entries = _currentWindowSettings().NewTabMenu();
|
||||
auto items = _CreateNewTabFlyoutItems(entries);
|
||||
for (const auto& item : items)
|
||||
{
|
||||
@@ -1023,7 +1023,7 @@ namespace winrt::TerminalApp::implementation
|
||||
profileMenuItem.Icon(icon);
|
||||
}
|
||||
|
||||
if (profile.Guid() == _settings.GlobalSettings().DefaultProfile())
|
||||
if (profile.Guid() == _currentWindowSettings().DefaultProfile())
|
||||
{
|
||||
// Contrast the default profile with others in font weight.
|
||||
profileMenuItem.FontWeight(FontWeights::Bold());
|
||||
@@ -1134,7 +1134,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (newTerminalArgs.ProfileIndex() != nullptr)
|
||||
{
|
||||
// We want to promote the index to a GUID because there is no "launch to profile index" command.
|
||||
const auto profile = _settings.GetProfileForArgs(newTerminalArgs);
|
||||
const auto profile = _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings());
|
||||
if (profile)
|
||||
{
|
||||
newTerminalArgs.Profile(::Microsoft::Console::Utils::GuidToString(profile.Guid()));
|
||||
@@ -1261,7 +1261,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
valueSet.Insert(L"passthroughMode", Windows::Foundation::PropertyValue::CreateBoolean(settings.VtPassthrough()));
|
||||
valueSet.Insert(L"reloadEnvironmentVariables",
|
||||
Windows::Foundation::PropertyValue::CreateBoolean(_settings.GlobalSettings().ReloadEnvironmentVariables()));
|
||||
Windows::Foundation::PropertyValue::CreateBoolean(_currentWindowSettings().ReloadEnvironmentVariables()));
|
||||
|
||||
if (inheritCursor)
|
||||
{
|
||||
@@ -1303,7 +1303,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
|
||||
profile = GetClosestProfileForDuplicationOfProfile(profile);
|
||||
controlSettings = TerminalSettings::CreateWithProfile(_settings, profile, *_bindings);
|
||||
controlSettings = TerminalSettings::CreateWithProfile(_settings, _currentWindowSettings(), profile, *_bindings);
|
||||
|
||||
// Replace the Starting directory with the CWD, if given
|
||||
const auto workingDirectory = control.WorkingDirectory();
|
||||
@@ -1947,7 +1947,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (!bypassDialog &&
|
||||
_HasMultipleTabs() &&
|
||||
_settings.GlobalSettings().ConfirmCloseAllTabs() &&
|
||||
_currentWindowSettings().ConfirmCloseAllTabs() &&
|
||||
!_displayingCloseDialog)
|
||||
{
|
||||
_displayingCloseDialog = true;
|
||||
@@ -2431,7 +2431,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - the title of the focused control if there is one, else "Terminal"
|
||||
hstring TerminalPage::Title()
|
||||
{
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar())
|
||||
if (_currentWindowSettings().ShowTitleInTitlebar())
|
||||
{
|
||||
auto selectedIndex = _tabView.SelectedIndex();
|
||||
if (selectedIndex >= 0)
|
||||
@@ -2528,7 +2528,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - See Pane::CalcSnappedDimension
|
||||
float TerminalPage::CalcSnappedDimension(const bool widthOrHeight, const float dimension) const
|
||||
{
|
||||
if (_settings && _settings.GlobalSettings().SnapToGridOnResize())
|
||||
if (_settings && _currentWindowSettings().SnapToGridOnResize())
|
||||
{
|
||||
if (const auto terminalTab{ _GetFocusedTabImpl() })
|
||||
{
|
||||
@@ -2555,7 +2555,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// iff it is set
|
||||
auto useGlobal = copiedData.Formats() == nullptr;
|
||||
auto copyFormats = useGlobal ?
|
||||
_settings.GlobalSettings().CopyFormatting() :
|
||||
_currentWindowSettings().CopyFormatting() :
|
||||
copiedData.Formats().Value();
|
||||
|
||||
// copy text to dataPack
|
||||
@@ -2628,7 +2628,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
if (_settings.GlobalSettings().TrimPaste())
|
||||
if (_currentWindowSettings().TrimPaste())
|
||||
{
|
||||
text = { Utils::TrimPaste(text) };
|
||||
if (text.empty())
|
||||
@@ -2639,7 +2639,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// If the requesting terminal is in bracketed paste mode, then we don't need to warn about a multi-line paste.
|
||||
auto warnMultiLine = _settings.GlobalSettings().WarnAboutMultiLinePaste() &&
|
||||
auto warnMultiLine = _currentWindowSettings().WarnAboutMultiLinePaste() &&
|
||||
!eventArgs.BracketedPasteEnabled();
|
||||
if (warnMultiLine)
|
||||
{
|
||||
@@ -2650,7 +2650,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
constexpr const std::size_t minimumSizeForWarning = 1024 * 5; // 5 KiB
|
||||
const auto warnLargeText = text.size() > minimumSizeForWarning &&
|
||||
_settings.GlobalSettings().WarnAboutLargePaste();
|
||||
_currentWindowSettings().WarnAboutLargePaste();
|
||||
|
||||
if (warnMultiLine || warnLargeText)
|
||||
{
|
||||
@@ -3018,7 +3018,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Don't need to worry about duplicating or anything - we'll
|
||||
// serialize the actual profile's GUID along with the content guid.
|
||||
const auto& profile = _settings.GetProfileForArgs(newTerminalArgs);
|
||||
const auto& profile = _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings());
|
||||
|
||||
const auto control = _AttachControlToContent(newTerminalArgs.ContentId());
|
||||
|
||||
@@ -3035,7 +3035,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
|
||||
profile = GetClosestProfileForDuplicationOfProfile(profile);
|
||||
controlSettings = TerminalSettings::CreateWithProfile(_settings, profile, *_bindings);
|
||||
controlSettings = TerminalSettings::CreateWithProfile(_settings, _currentWindowSettings(), profile, *_bindings);
|
||||
const auto workingDirectory = terminalTab->GetActiveTerminalControl().WorkingDirectory();
|
||||
const auto validWorkingDirectory = !workingDirectory.empty();
|
||||
if (validWorkingDirectory)
|
||||
@@ -3046,8 +3046,8 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
if (!profile)
|
||||
{
|
||||
profile = _settings.GetProfileForArgs(newTerminalArgs);
|
||||
controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings);
|
||||
profile = _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings());
|
||||
controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, _currentWindowSettings(), newTerminalArgs, *_bindings);
|
||||
}
|
||||
|
||||
// Try to handle auto-elevation
|
||||
@@ -3121,7 +3121,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_SetBackgroundImage(const winrt::Microsoft::Terminal::Settings::Model::IAppearanceConfig& newAppearance)
|
||||
{
|
||||
if (!_settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
if (!_currentWindowSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
_tabContent.Background(nullptr);
|
||||
return;
|
||||
@@ -3226,7 +3226,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto& pair{ found->second };
|
||||
if (!pair.second)
|
||||
{
|
||||
pair.second = TerminalSettings::CreateWithProfile(_settings, pair.first, *_bindings);
|
||||
pair.second = TerminalSettings::CreateWithProfile(_settings, _currentWindowSettings(), pair.first, *_bindings);
|
||||
}
|
||||
pane->UpdateSettings(pair.second, pair.first);
|
||||
}
|
||||
@@ -3266,15 +3266,15 @@ namespace winrt::TerminalApp::implementation
|
||||
// Reload the current value of alwaysOnTop from the settings file. This
|
||||
// will let the user hot-reload this setting, but any runtime changes to
|
||||
// the alwaysOnTop setting will be lost.
|
||||
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
|
||||
_isAlwaysOnTop = _currentWindowSettings().AlwaysOnTop();
|
||||
_AlwaysOnTopChangedHandlers(*this, nullptr);
|
||||
|
||||
// Settings AllowDependentAnimations will affect whether animations are
|
||||
// enabled application-wide, so we don't need to check it each time we
|
||||
// want to create an animation.
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_settings.GlobalSettings().DisableAnimations());
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_currentWindowSettings().DisableAnimations());
|
||||
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _currentWindowSettings().ShowAdminShield());
|
||||
|
||||
Media::SolidColorBrush transparent{ Windows::UI::Colors::Transparent() };
|
||||
_tabView.Background(transparent);
|
||||
@@ -3292,7 +3292,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// our TabView, to match the tab.showCloseButton property in the theme.
|
||||
//
|
||||
// Also update every tab's individual IsClosable to match the same property.
|
||||
const auto theme = _settings.GlobalSettings().CurrentTheme();
|
||||
const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
|
||||
const auto visibility = (theme && theme.Tab()) ?
|
||||
theme.Tab().ShowCloseButton() :
|
||||
Settings::Model::TabCloseButtonVisibility::Always;
|
||||
@@ -3825,7 +3825,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
});
|
||||
|
||||
auto newTabImpl = winrt::make_self<SettingsTab>(sui, _settings.GlobalSettings().CurrentTheme().RequestedTheme());
|
||||
auto newTabImpl = winrt::make_self<SettingsTab>(sui, _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()).RequestedTheme());
|
||||
|
||||
// Add the new tab to the list of our tabs.
|
||||
_tabs.Append(*newTabImpl);
|
||||
@@ -4082,7 +4082,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_UpdateTeachingTipTheme(winrt::Windows::UI::Xaml::FrameworkElement element)
|
||||
{
|
||||
auto theme{ _settings.GlobalSettings().CurrentTheme() };
|
||||
auto theme{ _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()) };
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
while (element)
|
||||
{
|
||||
@@ -4280,7 +4280,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (profile == _settings.ProfileDefaults())
|
||||
{
|
||||
return _settings.FindProfile(_settings.GlobalSettings().DefaultProfile());
|
||||
return _settings.FindProfile(_currentWindowSettings().DefaultProfile());
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
@@ -4526,7 +4526,7 @@ namespace winrt::TerminalApp::implementation
|
||||
return;
|
||||
}
|
||||
|
||||
const auto theme = _settings.GlobalSettings().CurrentTheme();
|
||||
const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
|
||||
{
|
||||
@@ -4563,7 +4563,7 @@ namespace winrt::TerminalApp::implementation
|
||||
terminalBrush = settingsTab.Content().try_as<Settings::Editor::MainPage>().BackgroundBrush();
|
||||
}
|
||||
|
||||
if (_settings.GlobalSettings().UseAcrylicInTabRow())
|
||||
if (_currentWindowSettings().UseAcrylicInTabRow())
|
||||
{
|
||||
const auto acrylicBrush = Media::AcrylicBrush();
|
||||
acrylicBrush.BackgroundSource(Media::AcrylicBackgroundSource::HostBackdrop);
|
||||
@@ -4587,7 +4587,7 @@ namespace winrt::TerminalApp::implementation
|
||||
TitlebarBrush(backgroundSolidBrush);
|
||||
}
|
||||
|
||||
if (!_settings.GlobalSettings().ShowTabsInTitlebar())
|
||||
if (!_currentWindowSettings().ShowTabsInTitlebar())
|
||||
{
|
||||
_tabRow.Background(TitlebarBrush());
|
||||
}
|
||||
@@ -4710,7 +4710,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Feature_ShellCompletions::IsEnabled back in _RegisterTerminalEvents
|
||||
|
||||
// User must explicitly opt-in on Preview builds
|
||||
if (!_settings.GlobalSettings().EnableShellCompletionMenu())
|
||||
if (!_currentWindowSettings().EnableShellCompletionMenu())
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
@@ -5136,4 +5136,10 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
return profileMenuItemFlyout;
|
||||
}
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::WindowSettings TerminalPage::_currentWindowSettings() const
|
||||
{
|
||||
const auto& currentName{ _WindowProperties.WindowName() };
|
||||
return _settings.WindowSettings(currentName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,6 +543,8 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::Microsoft::Terminal::Control::TermControl _senderOrActiveControl(const winrt::Windows::Foundation::IInspectable& sender);
|
||||
winrt::com_ptr<TerminalTab> _senderOrFocusedTab(const IInspectable& sender);
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::WindowSettings _currentWindowSettings() const;
|
||||
|
||||
#pragma region ActionHandlers
|
||||
// These are all defined in AppActionHandlers.cpp
|
||||
#define ON_ALL_ACTIONS(action) DECLARE_ACTION_HANDLER(action);
|
||||
|
||||
@@ -150,12 +150,14 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void TerminalTab::_UpdateHeaderControlMaxWidth()
|
||||
{
|
||||
// TODO! just pass a WindowSettings into the ctor and the UpdateSettings method, so we don't have to do this.
|
||||
// For now, just use the defaults.
|
||||
try
|
||||
{
|
||||
// Make sure to try/catch this, because the LocalTests won't be
|
||||
// able to use this helper.
|
||||
const auto settings{ winrt::TerminalApp::implementation::AppLogic::CurrentAppSettings() };
|
||||
if (settings.GlobalSettings().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
|
||||
if (settings.WindowSettingsDefaults().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
|
||||
{
|
||||
_headerControl.RenamerMaxWidth(HeaderRenameBoxWidthTitleLength);
|
||||
}
|
||||
|
||||
@@ -263,6 +263,11 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
Microsoft::Terminal::Settings::Model::WindowSettings TerminalWindow::_currentWindowSettings()
|
||||
{
|
||||
return _settings.WindowSettings(_WindowProperties->WindowName());
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::ElementTheme TerminalWindow::GetRequestedTheme()
|
||||
{
|
||||
return Theme().RequestedTheme();
|
||||
@@ -270,17 +275,17 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TerminalWindow::GetShowTabsInTitlebar()
|
||||
{
|
||||
return _settings.GlobalSettings().ShowTabsInTitlebar();
|
||||
return _currentWindowSettings().ShowTabsInTitlebar();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetInitialAlwaysOnTop()
|
||||
{
|
||||
return _settings.GlobalSettings().AlwaysOnTop();
|
||||
return _currentWindowSettings().AlwaysOnTop();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetMinimizeToNotificationArea()
|
||||
{
|
||||
return _settings.GlobalSettings().MinimizeToNotificationArea();
|
||||
return _currentWindowSettings().MinimizeToNotificationArea();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetAlwaysShowNotificationIcon()
|
||||
@@ -290,12 +295,12 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TerminalWindow::GetShowTitleInTitlebar()
|
||||
{
|
||||
return _settings.GlobalSettings().ShowTitleInTitlebar();
|
||||
return _currentWindowSettings().ShowTitleInTitlebar();
|
||||
}
|
||||
|
||||
Microsoft::Terminal::Settings::Model::Theme TerminalWindow::Theme()
|
||||
{
|
||||
return _settings.GlobalSettings().CurrentTheme();
|
||||
return _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
|
||||
}
|
||||
// Method Description:
|
||||
// - Show a ContentDialog with buttons to take further action. Uses the
|
||||
@@ -341,7 +346,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// details here, but it does have the desired effect.
|
||||
// It's not enough to set the theme on the dialog alone.
|
||||
auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
|
||||
auto theme{ _settings.GlobalSettings().CurrentTheme() };
|
||||
auto theme{ Theme() };
|
||||
auto requestedTheme{ theme.RequestedTheme() };
|
||||
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
|
||||
while (element)
|
||||
@@ -570,7 +575,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (_appArgs.GetSize().has_value() || (proposedSize.Width == 0 && proposedSize.Height == 0))
|
||||
{
|
||||
// Use the default profile to determine how big of a window we need.
|
||||
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, nullptr, nullptr) };
|
||||
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, _currentWindowSettings(), nullptr, nullptr) };
|
||||
|
||||
const til::size emptySize{};
|
||||
const auto commandlineSize = _appArgs.GetSize().value_or(emptySize);
|
||||
@@ -594,7 +599,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// GH#2061 - If the global setting "Always show tab bar" is
|
||||
// set or if "Show tabs in title bar" is set, then we'll need to add
|
||||
// the height of the tab bar here.
|
||||
if (_settings.GlobalSettings().ShowTabsInTitlebar())
|
||||
if (_currentWindowSettings().ShowTabsInTitlebar())
|
||||
{
|
||||
// In the past, we used to actually instantiate a TitlebarControl
|
||||
// and use Measure() to determine the DesiredSize of the control, to
|
||||
@@ -612,7 +617,7 @@ namespace winrt::TerminalApp::implementation
|
||||
static constexpr auto titlebarHeight = 40;
|
||||
proposedSize.Height += (titlebarHeight)*scale;
|
||||
}
|
||||
else if (_settings.GlobalSettings().AlwaysShowTabs())
|
||||
else if (_currentWindowSettings().AlwaysShowTabs())
|
||||
{
|
||||
// Same comment as above, but with a TabRowControl.
|
||||
//
|
||||
@@ -645,7 +650,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// GH#4620/#5801 - If the user passed --maximized or --fullscreen on the
|
||||
// commandline, then use that to override the value from the settings.
|
||||
const auto valueFromSettings = _settings.GlobalSettings().LaunchMode();
|
||||
const auto valueFromSettings = _currentWindowSettings().LaunchMode();
|
||||
const auto valueFromCommandlineArgs = _appArgs.GetLaunchMode();
|
||||
if (const auto layout = LoadPersistedLayout())
|
||||
{
|
||||
@@ -671,7 +676,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - a point containing the requested initial position in pixels.
|
||||
TerminalApp::InitialPosition TerminalWindow::GetInitialPosition(int64_t defaultInitialX, int64_t defaultInitialY)
|
||||
{
|
||||
auto initialPosition{ _settings.GlobalSettings().InitialPosition() };
|
||||
auto initialPosition{ _currentWindowSettings().InitialPosition() };
|
||||
|
||||
if (const auto layout = LoadPersistedLayout())
|
||||
{
|
||||
@@ -720,7 +725,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
return !_contentBounds &&
|
||||
!hadPersistedPosition &&
|
||||
_settings.GlobalSettings().CenterOnLaunch() &&
|
||||
_currentWindowSettings().CenterOnLaunch() &&
|
||||
!_appArgs.GetPosition().has_value();
|
||||
}
|
||||
|
||||
@@ -1183,7 +1188,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TerminalWindow::AutoHideWindow()
|
||||
{
|
||||
return _settings.GlobalSettings().AutoHideWindow();
|
||||
return _currentWindowSettings().AutoHideWindow();
|
||||
}
|
||||
|
||||
void TerminalWindow::UpdateSettingsHandler(const winrt::IInspectable& /*sender*/,
|
||||
|
||||
@@ -205,6 +205,8 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::Windows::Foundation::Collections::IVector<Microsoft::Terminal::Settings::Model::ActionAndArgs> _contentStringToActions(const winrt::hstring& content,
|
||||
const bool replaceFirstWithNewTab);
|
||||
|
||||
Microsoft::Terminal::Settings::Model::WindowSettings _currentWindowSettings();
|
||||
|
||||
// These are events that are handled by the TerminalPage, but are
|
||||
// exposed through the AppLogic. This macro is used to forward the event
|
||||
// directly to them.
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace TerminalApp
|
||||
void Maximized(Boolean newMaximized);
|
||||
Boolean AlwaysOnTop { get; };
|
||||
Boolean AutoHideWindow { get; };
|
||||
Microsoft.Terminal.Settings.Model.Theme Theme { get; };
|
||||
|
||||
void IdentifyWindow();
|
||||
void SetPersistedLayoutIdx(UInt32 idx);
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
constexpr std::wstring_view legacyDarkThemeName{ L"legacyDark" };
|
||||
constexpr std::wstring_view legacyLightThemeName{ L"legacyLight" };
|
||||
|
||||
GlobalAppearanceViewModel::GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings) :
|
||||
GlobalAppearanceViewModel::GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings) :
|
||||
_windowSettings{ windowSettings },
|
||||
_GlobalSettings{ globalSettings },
|
||||
_ThemeList{ single_threaded_observable_vector<Model::Theme>() }
|
||||
{
|
||||
@@ -211,7 +212,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
winrt::Windows::Foundation::IInspectable GlobalAppearanceViewModel::CurrentTheme()
|
||||
{
|
||||
return _GlobalSettings.CurrentTheme();
|
||||
return _GlobalSettings.CurrentTheme(_windowSettings);
|
||||
}
|
||||
|
||||
// Get the name out of the newly selected item, stash that as the Theme name
|
||||
@@ -221,7 +222,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
if (const auto& theme{ tag.try_as<Model::Theme>() })
|
||||
{
|
||||
_GlobalSettings.Theme(Model::ThemePair{ theme.Name() });
|
||||
_windowSettings.Theme(Model::ThemePair{ theme.Name() });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,12 +269,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
bool GlobalAppearanceViewModel::InvertedDisableAnimations()
|
||||
{
|
||||
return !_GlobalSettings.DisableAnimations();
|
||||
return !_windowSettings.DisableAnimations();
|
||||
}
|
||||
|
||||
void GlobalAppearanceViewModel::InvertedDisableAnimations(bool value)
|
||||
{
|
||||
_GlobalSettings.DisableAnimations(!value);
|
||||
_windowSettings.DisableAnimations(!value);
|
||||
}
|
||||
|
||||
void GlobalAppearanceViewModel::ShowTitlebarToggled(const winrt::Windows::Foundation::IInspectable& /* sender */, const RoutedEventArgs& /* args */)
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
struct GlobalAppearanceViewModel : GlobalAppearanceViewModelT<GlobalAppearanceViewModel>, ViewModelHelper<GlobalAppearanceViewModel>
|
||||
{
|
||||
public:
|
||||
GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings);
|
||||
GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings);
|
||||
|
||||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
||||
using ViewModelHelper<GlobalAppearanceViewModel>::PropertyChanged;
|
||||
|
||||
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Model::Theme>, ThemeList, nullptr);
|
||||
GETSET_BINDABLE_ENUM_SETTING(NewTabPosition, Model::NewTabPosition, _GlobalSettings.NewTabPosition);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _GlobalSettings.TabWidthMode);
|
||||
GETSET_BINDABLE_ENUM_SETTING(NewTabPosition, Model::NewTabPosition, _windowSettings.NewTabPosition);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _windowSettings.TabWidthMode);
|
||||
|
||||
public:
|
||||
// LanguageDisplayConverter maps the given BCP 47 tag to a localized string.
|
||||
@@ -41,16 +41,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
void ShowTitlebarToggled(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, UseAcrylicInTabRow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTitleInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysOnTop);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AutoHideWindow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, AlwaysShowTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ShowTabsInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, UseAcrylicInTabRow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ShowTitleInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, AlwaysOnTop);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, AutoHideWindow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowNotificationIcon);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, MinimizeToNotificationArea);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, MinimizeToNotificationArea);
|
||||
|
||||
private:
|
||||
Model::WindowSettings _windowSettings;
|
||||
Model::GlobalAppSettings _GlobalSettings;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> _languageList;
|
||||
winrt::Windows::Foundation::IInspectable _currentLanguage;
|
||||
|
||||
@@ -9,7 +9,8 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
runtimeclass GlobalAppearanceViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||
{
|
||||
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
|
||||
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings,
|
||||
Microsoft.Terminal.Settings.Model.WindowSettings windowSettings);
|
||||
|
||||
static String LanguageDisplayConverter(String tag);
|
||||
Boolean LanguageSelectorAvailable { get; };
|
||||
|
||||
@@ -12,8 +12,8 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
InteractionViewModel::InteractionViewModel(Model::GlobalAppSettings globalSettings) :
|
||||
_GlobalSettings{ globalSettings }
|
||||
InteractionViewModel::InteractionViewModel(Model::WindowSettings windowSettings) :
|
||||
_windowSettings{ windowSettings }
|
||||
{
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(TabSwitcherMode, TabSwitcherMode, TabSwitcherMode, L"Globals_TabSwitcherMode", L"Content");
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(CopyFormat, CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, L"Globals_CopyFormat", L"Content");
|
||||
|
||||
@@ -12,25 +12,25 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
struct InteractionViewModel : InteractionViewModelT<InteractionViewModel>, ViewModelHelper<InteractionViewModel>
|
||||
{
|
||||
public:
|
||||
InteractionViewModel(Model::GlobalAppSettings globalSettings);
|
||||
InteractionViewModel(Model::WindowSettings windowSettings);
|
||||
|
||||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
||||
using ViewModelHelper<InteractionViewModel>::PropertyChanged;
|
||||
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _GlobalSettings.TabSwitcherMode);
|
||||
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _GlobalSettings.CopyFormatting);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _windowSettings.TabSwitcherMode);
|
||||
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _windowSettings.CopyFormatting);
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, CopyOnSelect);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimBlockSelection);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimPaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ConfirmCloseAllTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, CopyOnSelect);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, TrimBlockSelection);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, TrimPaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, SnapToGridOnResize);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, FocusFollowMouse);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, DetectURLs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, WordDelimiters);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ConfirmCloseAllTabs);
|
||||
|
||||
private:
|
||||
Model::GlobalAppSettings _GlobalSettings;
|
||||
Model::WindowSettings _windowSettings;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
runtimeclass InteractionViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||
{
|
||||
InteractionViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
|
||||
InteractionViewModel(Microsoft.Terminal.Settings.Model.WindowSettings windowSettings);
|
||||
|
||||
IInspectable CurrentTabSwitcherMode;
|
||||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TabSwitcherModeList { get; };
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
double LaunchViewModel::InitialPosX()
|
||||
{
|
||||
const auto x = _Settings.GlobalSettings().InitialPosition().X;
|
||||
const auto x = _Settings.WindowSettingsDefaults().InitialPosition().X;
|
||||
// If there's no value here, return NAN - XAML will ignore it and
|
||||
// put the placeholder text in the box instead
|
||||
const auto xCoord = x.try_as<int32_t>();
|
||||
@@ -74,7 +74,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
double LaunchViewModel::InitialPosY()
|
||||
{
|
||||
const auto y = _Settings.GlobalSettings().InitialPosition().Y;
|
||||
const auto y = _Settings.WindowSettingsDefaults().InitialPosition().Y;
|
||||
// If there's no value here, return NAN - XAML will ignore it and
|
||||
// put the placeholder text in the box instead
|
||||
const auto yCoord = y.try_as<int32_t>();
|
||||
@@ -89,8 +89,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
xCoordRef = gsl::narrow_cast<int32_t>(xCoord);
|
||||
}
|
||||
const LaunchPosition newPos{ xCoordRef, _Settings.GlobalSettings().InitialPosition().Y };
|
||||
_Settings.GlobalSettings().InitialPosition(newPos);
|
||||
const LaunchPosition newPos{ xCoordRef, _Settings.WindowSettingsDefaults().InitialPosition().Y };
|
||||
_Settings.WindowSettingsDefaults().InitialPosition(newPos);
|
||||
_NotifyChanges(L"LaunchParametersCurrentValue");
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
yCoordRef = gsl::narrow_cast<int32_t>(yCoord);
|
||||
}
|
||||
const LaunchPosition newPos{ _Settings.GlobalSettings().InitialPosition().X, yCoordRef };
|
||||
_Settings.GlobalSettings().InitialPosition(newPos);
|
||||
const LaunchPosition newPos{ _Settings.WindowSettingsDefaults().InitialPosition().X, yCoordRef };
|
||||
_Settings.WindowSettingsDefaults().InitialPosition(newPos);
|
||||
_NotifyChanges(L"LaunchParametersCurrentValue");
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentLaunchMode()
|
||||
{
|
||||
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_LaunchModeMap.Lookup(_Settings.GlobalSettings().LaunchMode()));
|
||||
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_LaunchModeMap.Lookup(_Settings.WindowSettingsDefaults().LaunchMode()));
|
||||
}
|
||||
|
||||
void LaunchViewModel::CurrentLaunchMode(const winrt::Windows::Foundation::IInspectable& enumEntry)
|
||||
@@ -133,7 +133,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
if (const auto ee = enumEntry.try_as<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>())
|
||||
{
|
||||
const auto setting = winrt::unbox_value<LaunchMode>(ee.EnumValue());
|
||||
_Settings.GlobalSettings().LaunchMode(setting);
|
||||
_Settings.WindowSettingsDefaults().LaunchMode(setting);
|
||||
_NotifyChanges(L"LaunchParametersCurrentValue");
|
||||
}
|
||||
}
|
||||
@@ -145,14 +145,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentDefaultProfile()
|
||||
{
|
||||
const auto defaultProfileGuid{ _Settings.GlobalSettings().DefaultProfile() };
|
||||
const auto defaultProfileGuid{ _Settings.WindowSettingsDefaults().DefaultProfile() };
|
||||
return winrt::box_value(_Settings.FindProfile(defaultProfileGuid));
|
||||
}
|
||||
|
||||
void LaunchViewModel::CurrentDefaultProfile(const IInspectable& value)
|
||||
{
|
||||
const auto profile{ winrt::unbox_value<Model::Profile>(value) };
|
||||
_Settings.GlobalSettings().DefaultProfile(profile.Guid());
|
||||
_Settings.WindowSettingsDefaults().DefaultProfile(profile.Guid());
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> LaunchViewModel::DefaultProfiles() const
|
||||
|
||||
@@ -38,10 +38,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
GETSET_BINDABLE_ENUM_SETTING(FirstWindowPreference, Model::FirstWindowPreference, _Settings.GlobalSettings().FirstWindowPreference);
|
||||
GETSET_BINDABLE_ENUM_SETTING(WindowingBehavior, Model::WindowingMode, _Settings.GlobalSettings().WindowingBehavior);
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), CenterOnLaunch);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), CenterOnLaunch);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), StartOnUserLogin);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), InitialRows);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), InitialCols);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), InitialRows);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), InitialCols);
|
||||
|
||||
private:
|
||||
Model::CascadiaSettings _Settings;
|
||||
|
||||
@@ -355,7 +355,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
}
|
||||
else if (clickedItemTag == interactionTag)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::Interaction>(), winrt::make<InteractionViewModel>(_settingsClone.GlobalSettings()));
|
||||
contentFrame().Navigate(xaml_typename<Editor::Interaction>(), winrt::make<InteractionViewModel>(_settingsClone.WindowSettingsDefaults()));
|
||||
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Interaction/Content"), BreadcrumbSubPage::None);
|
||||
_breadcrumbs.Append(crumb);
|
||||
}
|
||||
@@ -406,7 +406,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
}
|
||||
else if (clickedItemTag == globalAppearanceTag)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::GlobalAppearance>(), winrt::make<GlobalAppearanceViewModel>(_settingsClone.GlobalSettings()));
|
||||
contentFrame().Navigate(xaml_typename<Editor::GlobalAppearance>(), winrt::make<GlobalAppearanceViewModel>(_settingsClone.GlobalSettings(), _settingsClone.WindowSettingsDefaults()));
|
||||
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Appearance/Content"), BreadcrumbSubPage::None);
|
||||
_breadcrumbs.Append(crumb);
|
||||
}
|
||||
@@ -695,8 +695,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& theme = _settingsSource.GlobalSettings().CurrentTheme();
|
||||
const auto& requestedTheme = _settingsSource.GlobalSettings().CurrentTheme().RequestedTheme();
|
||||
const auto& theme = _settingsSource.GlobalSettings().CurrentTheme(_settingsSource.WindowSettingsDefaults());
|
||||
const auto& requestedTheme = theme.RequestedTheme();
|
||||
|
||||
RequestedTheme(requestedTheme);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
Model::TerminalSettings ProfileViewModel::TermSettings() const
|
||||
{
|
||||
return Model::TerminalSettings::CreateForPreview(_appSettings, _profile);
|
||||
return Model::TerminalSettings::CreateForPreview(_appSettings, _appSettings.WindowSettingsDefaults(), _profile);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
explicit RenderingViewModel(Model::CascadiaSettings settings) noexcept;
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.ProfileDefaults(), UseAtlasEngine);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), ForceFullRepaintRendering);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), SoftwareRendering);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.WindowSettingsDefaults(), ForceFullRepaintRendering);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.WindowSettingsDefaults(), SoftwareRendering);
|
||||
|
||||
private:
|
||||
Model::CascadiaSettings _settings{ nullptr };
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <shlwapi.h>
|
||||
#include <til/latch.h>
|
||||
#include <til/string.h>
|
||||
#include "../inc/WindowingBehavior.h"
|
||||
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
@@ -104,6 +105,9 @@ Model::CascadiaSettings CascadiaSettings::Copy() const
|
||||
settings->_globals = _globals->Copy();
|
||||
settings->_allProfiles = winrt::single_threaded_observable_vector(std::move(allProfiles));
|
||||
settings->_activeProfiles = winrt::single_threaded_observable_vector(std::move(activeProfiles));
|
||||
settings->_baseWindowSettings = _baseWindowSettings->Copy();
|
||||
// TODO!
|
||||
// settings->_windows = _windows->Copy();
|
||||
}
|
||||
|
||||
// load errors
|
||||
@@ -197,6 +201,35 @@ Model::Profile CascadiaSettings::ProfileDefaults() const
|
||||
return *_baseLayerProfile;
|
||||
}
|
||||
|
||||
Model::WindowSettings CascadiaSettings::WindowSettingsDefaults() const
|
||||
{
|
||||
return *_baseWindowSettings;
|
||||
}
|
||||
|
||||
Model::WindowSettings CascadiaSettings::WindowSettings(const winrt::hstring& windowName) const
|
||||
{
|
||||
if (const auto& forName = _windows.TryLookup(windowName))
|
||||
{
|
||||
return forName;
|
||||
}
|
||||
else if (windowName == QuakeWindowName)
|
||||
{
|
||||
const auto& quakeSettings{ winrt::make_self<implementation::WindowSettings>() };
|
||||
quakeSettings->AddLeastImportantParent(_baseWindowSettings);
|
||||
quakeSettings->InitializeForQuakeMode();
|
||||
return *quakeSettings;
|
||||
}
|
||||
else
|
||||
{
|
||||
return *_baseWindowSettings;
|
||||
}
|
||||
}
|
||||
|
||||
IMap<winrt::hstring, Model::WindowSettings> CascadiaSettings::AllWindowSettings() const noexcept
|
||||
{
|
||||
return _windows;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Create a new profile based off the default profile settings.
|
||||
// Arguments:
|
||||
@@ -583,7 +616,9 @@ void CascadiaSettings::_validateProfileEnvironmentVariables()
|
||||
// and attempt to look the profile up by name instead.
|
||||
// Return Value:
|
||||
// - the GUID of the profile corresponding to this combination of index and NewTerminalArgs
|
||||
Model::Profile CascadiaSettings::GetProfileForArgs(const Model::NewTerminalArgs& newTerminalArgs) const
|
||||
Model::Profile CascadiaSettings::GetProfileForArgs(
|
||||
const Model::NewTerminalArgs& newTerminalArgs,
|
||||
const Model::WindowSettings& currentWindowSettings) const
|
||||
{
|
||||
if (newTerminalArgs)
|
||||
{
|
||||
@@ -627,7 +662,7 @@ Model::Profile CascadiaSettings::GetProfileForArgs(const Model::NewTerminalArgs&
|
||||
// Case 2 above could be the result of a "nt" or "sp" invocation that doesn't specify anything.
|
||||
// TODO GH#10952: Detect the profile based on the commandline (add matching support)
|
||||
return (!newTerminalArgs || newTerminalArgs.Commandline().empty()) ?
|
||||
FindProfile(GlobalSettings().DefaultProfile()) :
|
||||
FindProfile(currentWindowSettings.DefaultProfile()) :
|
||||
ProfileDefaults();
|
||||
}
|
||||
|
||||
@@ -1219,34 +1254,42 @@ void CascadiaSettings::_validateThemeExists()
|
||||
auto newTheme = winrt::make_self<Theme>();
|
||||
newTheme->Name(L"system");
|
||||
_globals->AddTheme(*newTheme);
|
||||
_globals->Theme(Model::ThemePair{ L"system" });
|
||||
_baseWindowSettings->Theme(Model::ThemePair{ L"system" });
|
||||
}
|
||||
|
||||
const auto& theme{ _globals->Theme() };
|
||||
if (theme.DarkName() == theme.LightName())
|
||||
const auto validateThemeForWindow = [&](auto& window) {
|
||||
const auto& theme{ window.Theme() };
|
||||
if (theme.DarkName() == theme.LightName())
|
||||
{
|
||||
// Only one theme. We'll treat it as such.
|
||||
if (!themes.HasKey(theme.DarkName()))
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::UnknownTheme);
|
||||
// safely fall back to system as the theme.
|
||||
window.Theme(*winrt::make_self<ThemePair>(L"system"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Two different themes. Check each separately, and fall back to a
|
||||
// reasonable default contextually
|
||||
if (!themes.HasKey(theme.LightName()))
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::UnknownTheme);
|
||||
theme.LightName(L"light");
|
||||
}
|
||||
if (!themes.HasKey(theme.DarkName()))
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::UnknownTheme);
|
||||
theme.DarkName(L"dark");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
validateThemeForWindow(*_baseWindowSettings);
|
||||
for (const auto& [name, window] : _windows)
|
||||
{
|
||||
// Only one theme. We'll treat it as such.
|
||||
if (!themes.HasKey(theme.DarkName()))
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::UnknownTheme);
|
||||
// safely fall back to system as the theme.
|
||||
_globals->Theme(*winrt::make_self<ThemePair>(L"system"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Two different themes. Check each separately, and fall back to a
|
||||
// reasonable default contextually
|
||||
if (!themes.HasKey(theme.LightName()))
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::UnknownTheme);
|
||||
theme.LightName(L"light");
|
||||
}
|
||||
if (!themes.HasKey(theme.DarkName()))
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::UnknownTheme);
|
||||
theme.DarkName(L"dark");
|
||||
}
|
||||
validateThemeForWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
winrt::com_ptr<implementation::GlobalAppSettings> globals;
|
||||
winrt::com_ptr<implementation::Profile> baseLayerProfile;
|
||||
winrt::com_ptr<implementation::WindowSettings> baseWindowSettings;
|
||||
std::vector<winrt::com_ptr<implementation::Profile>> profiles;
|
||||
std::unordered_map<winrt::guid, winrt::com_ptr<implementation::Profile>> profilesByGuid;
|
||||
std::unordered_map<winrt::hstring, winrt::com_ptr<implementation::WindowSettings>> windowsByName;
|
||||
|
||||
void clear();
|
||||
};
|
||||
@@ -74,6 +76,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
const Json::Value& profileDefaults;
|
||||
const Json::Value& profilesList;
|
||||
const Json::Value& themes;
|
||||
const Json::Value& windowDefaults;
|
||||
const Json::Value& windowsList;
|
||||
};
|
||||
|
||||
static std::pair<size_t, size_t> _lineAndColumnFromPosition(const std::string_view& string, const size_t position);
|
||||
@@ -116,6 +120,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
winrt::hstring Hash() const noexcept;
|
||||
Model::CascadiaSettings Copy() const;
|
||||
Model::GlobalAppSettings GlobalSettings() const;
|
||||
|
||||
Model::WindowSettings WindowSettingsDefaults() const;
|
||||
Model::WindowSettings WindowSettings(const winrt::hstring& windowName) const;
|
||||
Windows::Foundation::Collections::IMap<winrt::hstring, Model::WindowSettings> AllWindowSettings() const noexcept;
|
||||
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> AllProfiles() const noexcept;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> ActiveProfiles() const noexcept;
|
||||
Model::ActionMap ActionMap() const noexcept;
|
||||
@@ -125,7 +134,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
Model::Profile CreateNewProfile();
|
||||
Model::Profile FindProfile(const winrt::guid& guid) const noexcept;
|
||||
void UpdateColorSchemeReferences(const winrt::hstring& oldName, const winrt::hstring& newName);
|
||||
Model::Profile GetProfileForArgs(const Model::NewTerminalArgs& newTerminalArgs) const;
|
||||
Model::Profile GetProfileForArgs(const Model::NewTerminalArgs& newTerminalArgs, const Model::WindowSettings& currentWindowSettings) const;
|
||||
Model::Profile GetProfileByName(const winrt::hstring& name) const;
|
||||
Model::Profile GetProfileByIndex(uint32_t index) const;
|
||||
Model::Profile DuplicateProfile(const Model::Profile& source);
|
||||
@@ -156,7 +165,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
void _resolveDefaultProfile() const;
|
||||
void _resolveNewTabMenuProfiles() const;
|
||||
void _resolveNewTabMenuProfilesSet(const winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry> entries, winrt::Windows::Foundation::Collections::IMap<int, Model::Profile>& remainingProfiles, Model::RemainingProfilesEntry& remainingProfilesEntry) const;
|
||||
void _resolveNewTabMenuProfilesForWindow(const Model::WindowSettings& window) const;
|
||||
void _resolveNewTabMenuProfilesSet(const winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry> entries,
|
||||
winrt::Windows::Foundation::Collections::IMap<int, Model::Profile>& remainingProfiles,
|
||||
Model::RemainingProfilesEntry& remainingProfilesEntry) const;
|
||||
|
||||
void _validateSettings();
|
||||
void _validateAllSchemesExist();
|
||||
@@ -172,6 +184,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// user settings
|
||||
winrt::hstring _hash;
|
||||
winrt::com_ptr<implementation::GlobalAppSettings> _globals = winrt::make_self<implementation::GlobalAppSettings>();
|
||||
|
||||
winrt::com_ptr<implementation::WindowSettings> _baseWindowSettings = winrt::make_self<implementation::WindowSettings>();
|
||||
Windows::Foundation::Collections::IMap<winrt::hstring, Model::WindowSettings> _windows{ winrt::single_threaded_map<winrt::hstring, Model::WindowSettings>() };
|
||||
|
||||
winrt::com_ptr<implementation::Profile> _baseLayerProfile = winrt::make_self<implementation::Profile>();
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> _allProfiles = winrt::single_threaded_observable_vector<Model::Profile>();
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> _activeProfiles = winrt::single_threaded_observable_vector<Model::Profile>();
|
||||
|
||||
@@ -28,7 +28,9 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
String Hash { get; };
|
||||
|
||||
GlobalAppSettings GlobalSettings { get; };
|
||||
GlobalAppSettings GlobalSettings();
|
||||
WindowSettings WindowSettings(String windowName);
|
||||
WindowSettings WindowSettingsDefaults();
|
||||
|
||||
Profile ProfileDefaults { get; };
|
||||
|
||||
@@ -47,7 +49,7 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
Profile FindProfile(Guid profileGuid);
|
||||
void UpdateColorSchemeReferences(String oldName, String newName);
|
||||
|
||||
Profile GetProfileForArgs(NewTerminalArgs newTerminalArgs);
|
||||
Profile GetProfileForArgs(NewTerminalArgs newTerminalArgs, WindowSettings currentWindowSettings);
|
||||
|
||||
static Boolean IsDefaultTerminalAvailable { get; };
|
||||
static Boolean IsDefaultTerminalSet { get; };
|
||||
|
||||
@@ -47,6 +47,7 @@ static constexpr std::string_view DefaultSettingsKey{ "defaults" };
|
||||
static constexpr std::string_view ProfilesListKey{ "list" };
|
||||
static constexpr std::string_view SchemesKey{ "schemes" };
|
||||
static constexpr std::string_view ThemesKey{ "themes" };
|
||||
static constexpr std::string_view WindowsListKey{ "windows" };
|
||||
|
||||
constexpr std::wstring_view systemThemeName{ L"system" };
|
||||
constexpr std::wstring_view darkThemeName{ L"dark" };
|
||||
@@ -111,8 +112,10 @@ void ParsedSettings::clear()
|
||||
{
|
||||
globals = {};
|
||||
baseLayerProfile = {};
|
||||
baseWindowSettings = {};
|
||||
profiles.clear();
|
||||
profilesByGuid.clear();
|
||||
windowsByName.clear();
|
||||
}
|
||||
|
||||
// This is a convenience method used by the CascadiaSettings constructor.
|
||||
@@ -191,7 +194,7 @@ void SettingsLoader::ApplyRuntimeInitialSettings()
|
||||
}
|
||||
}
|
||||
|
||||
userSettings.globals->DefaultProfile(guid);
|
||||
userSettings.baseWindowSettings->DefaultProfile(guid);
|
||||
}
|
||||
|
||||
// 2.
|
||||
@@ -335,6 +338,7 @@ void SettingsLoader::FinalizeLayering()
|
||||
{
|
||||
// Layer default globals -> user globals
|
||||
userSettings.globals->AddLeastImportantParent(inboxSettings.globals);
|
||||
userSettings.baseWindowSettings->AddLeastImportantParent(inboxSettings.baseWindowSettings);
|
||||
|
||||
// Actions are currently global, so if we want to conditionally light up a bunch of
|
||||
// actions, this is the time to do it.
|
||||
@@ -365,6 +369,25 @@ void SettingsLoader::FinalizeLayering()
|
||||
profile->Hidden(profile->Hidden());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO! update comments. I literally just copy-pasted this
|
||||
// Layer user profile defaults -> user profiles
|
||||
for (const auto& [_, window] : userSettings.windowsByName)
|
||||
{
|
||||
window->AddMostImportantParent(userSettings.baseWindowSettings);
|
||||
|
||||
// This completes the parenting process that was started in _addUserProfileParent().
|
||||
window->_FinalizeInheritance();
|
||||
// TODO! do we need this?
|
||||
// if (window->Origin() == OriginTag::None)
|
||||
// {
|
||||
// // If you add more fields here, make sure to do the same in
|
||||
// // implementation::CreateChild().
|
||||
// window->Origin(OriginTag::User);
|
||||
// window->Name(profile->Name());
|
||||
// window->Hidden(profile->Hidden());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Let's say a user doesn't know that they need to write `"hidden": true` in
|
||||
@@ -568,6 +591,18 @@ void SettingsLoader::_parse(const OriginTag origin, const winrt::hstring& source
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
settings.baseWindowSettings = WindowSettings::FromJson(json.root);
|
||||
|
||||
for (const auto& windowJson : json.windowsList)
|
||||
{
|
||||
if (auto window = WindowSettings::FromJson(windowJson))
|
||||
{
|
||||
settings.windowsByName.insert({ window->Name(), window });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
for (const auto& themeJson : json.themes)
|
||||
{
|
||||
@@ -688,10 +723,15 @@ SettingsLoader::JsonSettings SettingsLoader::_parseJson(const std::string_view&
|
||||
auto root = content.empty() ? Json::Value{ Json::ValueType::objectValue } : _parseJSON(content);
|
||||
const auto& colorSchemes = _getJSONValue(root, SchemesKey);
|
||||
const auto& themes = _getJSONValue(root, ThemesKey);
|
||||
|
||||
const auto& profilesObject = _getJSONValue(root, ProfilesKey);
|
||||
const auto& profileDefaults = _getJSONValue(profilesObject, DefaultSettingsKey);
|
||||
const auto& profilesList = profilesObject.isArray() ? profilesObject : _getJSONValue(profilesObject, ProfilesListKey);
|
||||
return JsonSettings{ std::move(root), colorSchemes, profileDefaults, profilesList, themes };
|
||||
|
||||
const auto& windowsDefaults = content.empty() ? Json::Value{ Json::ValueType::objectValue } : _parseJSON(content);
|
||||
const auto& windowsList = _getJSONValue(root, WindowsListKey);
|
||||
|
||||
return JsonSettings{ std::move(root), colorSchemes, profileDefaults, profilesList, themes, windowsDefaults, windowsList };
|
||||
}
|
||||
|
||||
// Just a common helper function between _parse and _parseFragment.
|
||||
@@ -959,8 +999,8 @@ void CascadiaSettings::_researchOnLoad()
|
||||
|
||||
// ----------------------------- RE: Themes ----------------------------
|
||||
const auto numThemes = GlobalSettings().Themes().Size();
|
||||
const auto themeInUse = GlobalSettings().CurrentTheme().Name();
|
||||
const auto changedTheme = GlobalSettings().HasTheme();
|
||||
const auto themeInUse = GlobalSettings().CurrentTheme(*_baseWindowSettings).Name();
|
||||
const auto changedTheme = _baseWindowSettings->HasTheme();
|
||||
|
||||
// system: 0
|
||||
// light: 1
|
||||
@@ -1063,6 +1103,7 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) :
|
||||
std::vector<Model::Profile> allProfiles;
|
||||
std::vector<Model::Profile> activeProfiles;
|
||||
std::vector<Model::SettingsLoadWarnings> warnings;
|
||||
std::map<winrt::hstring, Model::WindowSettings> windows;
|
||||
|
||||
allProfiles.reserve(loader.userSettings.profiles.size());
|
||||
activeProfiles.reserve(loader.userSettings.profiles.size());
|
||||
@@ -1104,6 +1145,12 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) :
|
||||
warnings.emplace_back(Model::SettingsLoadWarnings::DuplicateProfile);
|
||||
}
|
||||
|
||||
for (const auto& [name, window] : loader.userSettings.windowsByName)
|
||||
{
|
||||
// TODO! handle layering
|
||||
windows.insert({ name, *window });
|
||||
}
|
||||
|
||||
// SettingsLoader and ParsedSettings are supposed to always
|
||||
// create these two members. We don't want null-pointer exceptions.
|
||||
assert(loader.userSettings.globals != nullptr);
|
||||
@@ -1113,6 +1160,8 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) :
|
||||
_baseLayerProfile = loader.userSettings.baseLayerProfile;
|
||||
_allProfiles = winrt::single_threaded_observable_vector(std::move(allProfiles));
|
||||
_activeProfiles = winrt::single_threaded_observable_vector(std::move(activeProfiles));
|
||||
_baseWindowSettings = loader.userSettings.baseWindowSettings;
|
||||
_windows = winrt::single_threaded_map<winrt::hstring, Model::WindowSettings>(std::move(windows));
|
||||
_warnings = winrt::single_threaded_vector(std::move(warnings));
|
||||
|
||||
_resolveDefaultProfile();
|
||||
@@ -1300,6 +1349,25 @@ Json::Value CascadiaSettings::ToJson() const
|
||||
}
|
||||
json[JsonKey(ThemesKey)] = themes;
|
||||
|
||||
Json::Value baseWindowSettings{ _baseWindowSettings->ToJson() };
|
||||
// merge the base window settings into the globals
|
||||
for (const auto& key : baseWindowSettings.getMemberNames())
|
||||
{
|
||||
json[key] = baseWindowSettings[key];
|
||||
}
|
||||
|
||||
// Now serialize any windows too, if we had some.
|
||||
if (_windows.Size() > 0)
|
||||
{
|
||||
Json::Value windows{ Json::ValueType::arrayValue };
|
||||
for (const auto& [_, projectedWindow] : _windows)
|
||||
{
|
||||
const auto& window{ winrt::get_self<implementation::WindowSettings>(projectedWindow) };
|
||||
windows.append(window->ToJson());
|
||||
}
|
||||
json[JsonKey(WindowsListKey)] = windows;
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -1308,19 +1376,34 @@ Json::Value CascadiaSettings::ToJson() const
|
||||
// and stores it back to the globals.
|
||||
void CascadiaSettings::_resolveDefaultProfile() const
|
||||
{
|
||||
if (const auto unparsedDefaultProfile = _globals->UnparsedDefaultProfile(); !unparsedDefaultProfile.empty())
|
||||
{
|
||||
if (const auto profile = GetProfileByName(unparsedDefaultProfile))
|
||||
const auto firstProfileGuid{ _allProfiles.GetAt(0).Guid() };
|
||||
bool raisedWarning = false;
|
||||
|
||||
const auto resolveDefaultProfileForWindow = [&](auto& window) {
|
||||
if (const auto unparsedDefaultProfile = window.UnparsedDefaultProfile(); !unparsedDefaultProfile.empty())
|
||||
{
|
||||
_globals->DefaultProfile(profile.Guid());
|
||||
return;
|
||||
if (const auto profile = GetProfileByName(unparsedDefaultProfile))
|
||||
{
|
||||
window.DefaultProfile(profile.Guid());
|
||||
return;
|
||||
}
|
||||
if (!raisedWarning)
|
||||
{
|
||||
_warnings.Append(SettingsLoadWarnings::MissingDefaultProfile);
|
||||
raisedWarning = true;
|
||||
}
|
||||
}
|
||||
|
||||
_warnings.Append(SettingsLoadWarnings::MissingDefaultProfile);
|
||||
}
|
||||
// Use the first profile as the new default.
|
||||
window.DefaultProfile(firstProfileGuid);
|
||||
};
|
||||
|
||||
// Use the first profile as the new default.
|
||||
GlobalSettings().DefaultProfile(_allProfiles.GetAt(0).Guid());
|
||||
resolveDefaultProfileForWindow(*_baseWindowSettings);
|
||||
|
||||
for (const auto& [_, window] : _windows)
|
||||
{
|
||||
resolveDefaultProfileForWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -1332,6 +1415,18 @@ void CascadiaSettings::_resolveDefaultProfile() const
|
||||
// multiple of these entries are found.
|
||||
void CascadiaSettings::_resolveNewTabMenuProfiles() const
|
||||
{
|
||||
_resolveNewTabMenuProfilesForWindow(*_baseWindowSettings);
|
||||
|
||||
for (const auto& [_, window] : _windows)
|
||||
{
|
||||
_resolveNewTabMenuProfilesForWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
void CascadiaSettings::_resolveNewTabMenuProfilesForWindow(const Model::WindowSettings& window) const
|
||||
{
|
||||
const auto windowImpl{ get_self<implementation::WindowSettings>(window) };
|
||||
|
||||
Model::RemainingProfilesEntry remainingProfilesEntry = nullptr;
|
||||
|
||||
// The TerminalPage needs to know which profile has which profile ID. To prevent
|
||||
@@ -1350,7 +1445,7 @@ void CascadiaSettings::_resolveNewTabMenuProfiles() const
|
||||
auto remainingProfiles = single_threaded_map(std::move(remainingProfilesMap));
|
||||
|
||||
// We call a recursive helper function to process the entries
|
||||
auto entries = _globals->NewTabMenu();
|
||||
auto entries = windowImpl->NewTabMenu();
|
||||
_resolveNewTabMenuProfilesSet(entries, remainingProfiles, remainingProfilesEntry);
|
||||
|
||||
// If a "remainingProfiles" entry has been found, assign to it the remaining profiles
|
||||
@@ -1364,9 +1459,9 @@ void CascadiaSettings::_resolveNewTabMenuProfiles() const
|
||||
// this value is regenerated on every "get" operation, so the effect of setting
|
||||
// the remaining profiles above will be undone. So only in the case that no custom
|
||||
// value is present in GlobalAppSettings, we will store the modified default value.
|
||||
if (!_globals->HasNewTabMenu())
|
||||
if (!windowImpl->HasNewTabMenu())
|
||||
{
|
||||
_globals->NewTabMenu(entries);
|
||||
windowImpl->NewTabMenu(entries);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ winrt::com_ptr<GlobalAppSettings> GlobalAppSettings::Copy() const
|
||||
{
|
||||
auto globals{ winrt::make_self<GlobalAppSettings>() };
|
||||
|
||||
globals->_UnparsedDefaultProfile = _UnparsedDefaultProfile;
|
||||
// globals->_UnparsedDefaultProfile = _UnparsedDefaultProfile;
|
||||
|
||||
globals->_defaultProfile = _defaultProfile;
|
||||
// globals->_defaultProfile = _defaultProfile;
|
||||
globals->_actionMap = _actionMap->Copy();
|
||||
globals->_keybindingsWarnings = _keybindingsWarnings;
|
||||
|
||||
@@ -97,16 +97,16 @@ winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, winrt::Microso
|
||||
|
||||
#pragma region DefaultProfile
|
||||
|
||||
void GlobalAppSettings::DefaultProfile(const winrt::guid& defaultProfile) noexcept
|
||||
{
|
||||
_defaultProfile = defaultProfile;
|
||||
_UnparsedDefaultProfile = Utils::GuidToString(defaultProfile);
|
||||
}
|
||||
// void GlobalAppSettings::DefaultProfile(const winrt::guid& defaultProfile) noexcept
|
||||
// {
|
||||
// _defaultProfile = defaultProfile;
|
||||
// _UnparsedDefaultProfile = Utils::GuidToString(defaultProfile);
|
||||
// }
|
||||
|
||||
winrt::guid GlobalAppSettings::DefaultProfile() const
|
||||
{
|
||||
return _defaultProfile;
|
||||
}
|
||||
// winrt::guid GlobalAppSettings::DefaultProfile() const
|
||||
// {
|
||||
// return _defaultProfile;
|
||||
// }
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -130,11 +130,11 @@ winrt::com_ptr<GlobalAppSettings> GlobalAppSettings::FromJson(const Json::Value&
|
||||
|
||||
void GlobalAppSettings::LayerJson(const Json::Value& json)
|
||||
{
|
||||
JsonUtils::GetValueForKey(json, DefaultProfileKey, _UnparsedDefaultProfile);
|
||||
// GH#8076 - when adding enum values to this key, we also changed it from
|
||||
// "useTabSwitcher" to "tabSwitcherMode". Continue supporting
|
||||
// "useTabSwitcher", but prefer "tabSwitcherMode"
|
||||
JsonUtils::GetValueForKey(json, LegacyUseTabSwitcherModeKey, _TabSwitcherMode);
|
||||
// JsonUtils::GetValueForKey(json, DefaultProfileKey, _UnparsedDefaultProfile);
|
||||
// // GH#8076 - when adding enum values to this key, we also changed it from
|
||||
// // "useTabSwitcher" to "tabSwitcherMode". Continue supporting
|
||||
// // "useTabSwitcher", but prefer "tabSwitcherMode"
|
||||
// JsonUtils::GetValueForKey(json, LegacyUseTabSwitcherModeKey, _TabSwitcherMode);
|
||||
|
||||
#define GLOBAL_SETTINGS_LAYER_JSON(type, name, jsonKey, ...) \
|
||||
JsonUtils::GetValueForKey(json, jsonKey, _##name);
|
||||
@@ -199,8 +199,6 @@ Json::Value GlobalAppSettings::ToJson() const
|
||||
{
|
||||
Json::Value json{ Json::ValueType::objectValue };
|
||||
|
||||
JsonUtils::SetValueForKey(json, DefaultProfileKey, _UnparsedDefaultProfile);
|
||||
|
||||
#define GLOBAL_SETTINGS_TO_JSON(type, name, jsonKey, ...) \
|
||||
JsonUtils::SetValueForKey(json, jsonKey, _##name);
|
||||
MTSM_GLOBAL_SETTINGS(GLOBAL_SETTINGS_TO_JSON)
|
||||
@@ -210,19 +208,20 @@ Json::Value GlobalAppSettings::ToJson() const
|
||||
return json;
|
||||
}
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::Theme GlobalAppSettings::CurrentTheme() noexcept
|
||||
winrt::Microsoft::Terminal::Settings::Model::Theme GlobalAppSettings::CurrentTheme(const Model::WindowSettings& window) noexcept
|
||||
{
|
||||
auto requestedTheme = Model::Theme::IsSystemInDarkTheme() ?
|
||||
winrt::Windows::UI::Xaml::ElementTheme::Dark :
|
||||
winrt::Windows::UI::Xaml::ElementTheme::Light;
|
||||
|
||||
const auto& themePair{ window.Theme() };
|
||||
switch (requestedTheme)
|
||||
{
|
||||
case winrt::Windows::UI::Xaml::ElementTheme::Light:
|
||||
return _themes.TryLookup(Theme().LightName());
|
||||
return _themes.TryLookup(themePair.LightName());
|
||||
|
||||
case winrt::Windows::UI::Xaml::ElementTheme::Dark:
|
||||
return _themes.TryLookup(Theme().DarkName());
|
||||
return _themes.TryLookup(themePair.DarkName());
|
||||
|
||||
case winrt::Windows::UI::Xaml::ElementTheme::Default:
|
||||
default:
|
||||
|
||||
@@ -25,6 +25,7 @@ Author(s):
|
||||
#include "Theme.h"
|
||||
#include "NewTabMenuEntry.h"
|
||||
#include "RemainingProfilesEntry.h"
|
||||
#include "WindowSettings.h"
|
||||
|
||||
// fwdecl unittest classes
|
||||
namespace SettingsModelLocalTests
|
||||
@@ -54,20 +55,20 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
const std::vector<SettingsLoadWarnings>& KeybindingsWarnings() const;
|
||||
|
||||
// This DefaultProfile() setter is called by CascadiaSettings,
|
||||
// when it parses UnparsedDefaultProfile in _finalizeSettings().
|
||||
void DefaultProfile(const guid& defaultProfile) noexcept;
|
||||
guid DefaultProfile() const;
|
||||
// // This DefaultProfile() setter is called by CascadiaSettings,
|
||||
// // when it parses UnparsedDefaultProfile in _finalizeSettings().
|
||||
// void DefaultProfile(const guid& defaultProfile) noexcept;
|
||||
// guid DefaultProfile() const;
|
||||
|
||||
Windows::Foundation::Collections::IMapView<hstring, Model::Theme> Themes() noexcept;
|
||||
void AddTheme(const Model::Theme& theme);
|
||||
Model::Theme CurrentTheme() noexcept;
|
||||
Model::Theme CurrentTheme(const Model::WindowSettings& window) noexcept;
|
||||
bool ShouldUsePersistedLayout() const;
|
||||
|
||||
void ExpandCommands(const Windows::Foundation::Collections::IVectorView<Model::Profile>& profiles,
|
||||
const Windows::Foundation::Collections::IMapView<winrt::hstring, Model::ColorScheme>& schemes);
|
||||
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, hstring, UnparsedDefaultProfile, L"");
|
||||
// INHERITABLE_SETTING(Model::GlobalAppSettings, hstring, UnparsedDefaultProfile, L"");
|
||||
|
||||
#define GLOBAL_SETTINGS_INITIALIZE(type, name, jsonKey, ...) \
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, type, name, ##__VA_ARGS__)
|
||||
@@ -81,7 +82,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
static constexpr bool debugFeaturesDefault{ true };
|
||||
#endif
|
||||
|
||||
winrt::guid _defaultProfile;
|
||||
// winrt::guid _defaultProfile;
|
||||
winrt::com_ptr<implementation::ActionMap> _actionMap{ winrt::make_self<implementation::ActionMap>() };
|
||||
|
||||
std::vector<SettingsLoadWarnings> _keybindingsWarnings;
|
||||
|
||||
@@ -50,59 +50,18 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass GlobalAppSettings {
|
||||
Guid DefaultProfile;
|
||||
|
||||
INHERITABLE_SETTING(String, UnparsedDefaultProfile);
|
||||
|
||||
INHERITABLE_SETTING(Int32, InitialRows);
|
||||
INHERITABLE_SETTING(Int32, InitialCols);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowTabs);
|
||||
INHERITABLE_SETTING(NewTabPosition, NewTabPosition);
|
||||
INHERITABLE_SETTING(Boolean, ShowTitleInTitlebar);
|
||||
INHERITABLE_SETTING(Boolean, ConfirmCloseAllTabs);
|
||||
INHERITABLE_SETTING(String, Language);
|
||||
INHERITABLE_SETTING(Microsoft.UI.Xaml.Controls.TabViewWidthMode, TabWidthMode);
|
||||
INHERITABLE_SETTING(Boolean, UseAcrylicInTabRow);
|
||||
INHERITABLE_SETTING(Boolean, ShowTabsInTitlebar);
|
||||
INHERITABLE_SETTING(String, WordDelimiters);
|
||||
INHERITABLE_SETTING(Boolean, CopyOnSelect);
|
||||
INHERITABLE_SETTING(Boolean, InputServiceWarning);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
|
||||
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
|
||||
INHERITABLE_SETTING(Boolean, WarnAboutMultiLinePaste);
|
||||
INHERITABLE_SETTING(Boolean, TrimPaste);
|
||||
INHERITABLE_SETTING(LaunchPosition, InitialPosition);
|
||||
INHERITABLE_SETTING(Boolean, CenterOnLaunch);
|
||||
INHERITABLE_SETTING(FirstWindowPreference, FirstWindowPreference);
|
||||
INHERITABLE_SETTING(LaunchMode, LaunchMode);
|
||||
INHERITABLE_SETTING(Boolean, SnapToGridOnResize);
|
||||
INHERITABLE_SETTING(Boolean, ForceFullRepaintRendering);
|
||||
INHERITABLE_SETTING(Boolean, SoftwareRendering);
|
||||
INHERITABLE_SETTING(Boolean, UseBackgroundImageForWindow);
|
||||
INHERITABLE_SETTING(Boolean, ReloadEnvironmentVariables);
|
||||
INHERITABLE_SETTING(Boolean, ForceVTInput);
|
||||
INHERITABLE_SETTING(Boolean, DebugFeaturesEnabled);
|
||||
INHERITABLE_SETTING(Boolean, StartOnUserLogin);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysOnTop);
|
||||
INHERITABLE_SETTING(Boolean, AutoHideWindow);
|
||||
INHERITABLE_SETTING(TabSwitcherMode, TabSwitcherMode);
|
||||
INHERITABLE_SETTING(Boolean, DisableAnimations);
|
||||
INHERITABLE_SETTING(String, StartupActions);
|
||||
INHERITABLE_SETTING(Boolean, FocusFollowMouse);
|
||||
INHERITABLE_SETTING(WindowingMode, WindowingBehavior);
|
||||
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
||||
INHERITABLE_SETTING(Boolean, DetectURLs);
|
||||
INHERITABLE_SETTING(Boolean, MinimizeToNotificationArea);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowNotificationIcon);
|
||||
INHERITABLE_SETTING(IVector<String>, DisabledProfileSources);
|
||||
INHERITABLE_SETTING(Boolean, ShowAdminShield);
|
||||
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableColorSelection);
|
||||
INHERITABLE_SETTING(Boolean, EnableShellCompletionMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableUnfocusedAcrylic);
|
||||
INHERITABLE_SETTING(Boolean, IsolatedMode);
|
||||
INHERITABLE_SETTING(Boolean, AllowHeadless);
|
||||
INHERITABLE_SETTING(String, SearchWebDefaultQueryUrl);
|
||||
INHERITABLE_SETTING(Boolean, EnableColorSelection); // Conditionally lights up a bunch of keybindings, so that should be global
|
||||
|
||||
Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
|
||||
void AddColorScheme(ColorScheme scheme);
|
||||
@@ -112,9 +71,57 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
Windows.Foundation.Collections.IMapView<String, Theme> Themes();
|
||||
void AddTheme(Theme theme);
|
||||
INHERITABLE_SETTING(ThemePair, Theme);
|
||||
Theme CurrentTheme { get; };
|
||||
Theme CurrentTheme(WindowSettings window);
|
||||
|
||||
Boolean ShouldUsePersistedLayout();
|
||||
}
|
||||
|
||||
[default_interface] runtimeclass WindowSettings {
|
||||
|
||||
String Name { get; };
|
||||
|
||||
Guid DefaultProfile;
|
||||
INHERITABLE_SETTING(String, UnparsedDefaultProfile);
|
||||
|
||||
INHERITABLE_SETTING(Int32, InitialRows);
|
||||
INHERITABLE_SETTING(Int32, InitialCols);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowTabs);
|
||||
INHERITABLE_SETTING(NewTabPosition, NewTabPosition);
|
||||
INHERITABLE_SETTING(Boolean, ShowTitleInTitlebar);
|
||||
INHERITABLE_SETTING(Boolean, ConfirmCloseAllTabs);
|
||||
INHERITABLE_SETTING(Microsoft.UI.Xaml.Controls.TabViewWidthMode, TabWidthMode);
|
||||
INHERITABLE_SETTING(Boolean, UseAcrylicInTabRow);
|
||||
INHERITABLE_SETTING(Boolean, ShowTabsInTitlebar);
|
||||
INHERITABLE_SETTING(String, WordDelimiters);
|
||||
INHERITABLE_SETTING(Boolean, CopyOnSelect);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
|
||||
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
|
||||
INHERITABLE_SETTING(Boolean, WarnAboutMultiLinePaste);
|
||||
INHERITABLE_SETTING(Boolean, TrimPaste);
|
||||
INHERITABLE_SETTING(LaunchPosition, InitialPosition);
|
||||
INHERITABLE_SETTING(Boolean, CenterOnLaunch);
|
||||
INHERITABLE_SETTING(LaunchMode, LaunchMode);
|
||||
INHERITABLE_SETTING(Boolean, SnapToGridOnResize);
|
||||
INHERITABLE_SETTING(Boolean, ForceFullRepaintRendering);
|
||||
INHERITABLE_SETTING(Boolean, SoftwareRendering);
|
||||
INHERITABLE_SETTING(Boolean, UseBackgroundImageForWindow);
|
||||
INHERITABLE_SETTING(Boolean, ReloadEnvironmentVariables);
|
||||
INHERITABLE_SETTING(Boolean, ForceVTInput);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysOnTop);
|
||||
INHERITABLE_SETTING(Boolean, AutoHideWindow);
|
||||
INHERITABLE_SETTING(TabSwitcherMode, TabSwitcherMode);
|
||||
INHERITABLE_SETTING(Boolean, DisableAnimations);
|
||||
INHERITABLE_SETTING(String, StartupActions);
|
||||
INHERITABLE_SETTING(Boolean, FocusFollowMouse);
|
||||
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
||||
INHERITABLE_SETTING(Boolean, DetectURLs);
|
||||
INHERITABLE_SETTING(Boolean, MinimizeToNotificationArea);
|
||||
INHERITABLE_SETTING(Boolean, ShowAdminShield);
|
||||
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableShellCompletionMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableUnfocusedAcrylic);
|
||||
INHERITABLE_SETTING(String, SearchWebDefaultQueryUrl);
|
||||
|
||||
INHERITABLE_SETTING(ThemePair, Theme);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ Author(s):
|
||||
#pragma once
|
||||
|
||||
#include <json.h>
|
||||
#include <til/winrt.h>
|
||||
|
||||
#include "../types/inc/utils.hpp"
|
||||
|
||||
@@ -354,6 +355,30 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ConversionTrait<til::property<T>>
|
||||
{
|
||||
til::property<T> FromJson(const Json::Value& json) const
|
||||
{
|
||||
return til::property<T>(static_cast<T>(ConversionTrait<T>{}.FromJson(json)));
|
||||
}
|
||||
|
||||
bool CanConvert(const Json::Value& json) const
|
||||
{
|
||||
return ConversionTrait<T>{}.CanConvert(json);
|
||||
}
|
||||
|
||||
Json::Value ToJson(const til::property<T>& val)
|
||||
{
|
||||
return ConversionTrait<T>{}.ToJson(val());
|
||||
}
|
||||
|
||||
std::string TypeDescription() const
|
||||
{
|
||||
return ConversionTrait<T>{}.TypeDescription();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ConversionTrait<std::vector<T>>
|
||||
{
|
||||
|
||||
@@ -18,7 +18,20 @@ Author(s):
|
||||
// Macro format (defaultArgs are optional):
|
||||
// (type, name, jsonKey, defaultArgs)
|
||||
|
||||
#define MTSM_GLOBAL_SETTINGS(X) \
|
||||
#define MTSM_GLOBAL_SETTINGS(X) \
|
||||
X(hstring, Language, "language") \
|
||||
X(bool, InputServiceWarning, "inputServiceWarning", true) \
|
||||
X(Model::FirstWindowPreference, FirstWindowPreference, "firstWindowPreference", FirstWindowPreference::DefaultProfile) \
|
||||
X(bool, DebugFeaturesEnabled, "debugFeatures", debugFeaturesDefault) \
|
||||
X(bool, StartOnUserLogin, "startOnUserLogin", false) \
|
||||
X(Model::WindowingMode, WindowingBehavior, "windowingBehavior", Model::WindowingMode::UseNew) \
|
||||
X(bool, AlwaysShowNotificationIcon, "alwaysShowNotificationIcon", false) \
|
||||
X(winrt::Windows::Foundation::Collections::IVector<winrt::hstring>, DisabledProfileSources, "disabledProfileSources", nullptr) \
|
||||
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
|
||||
X(bool, IsolatedMode, "compatibility.isolatedMode", false) \
|
||||
X(bool, EnableColorSelection, "experimental.enableColorSelection", false)
|
||||
|
||||
#define MTSM_WINDOW_SETTINGS(X) \
|
||||
X(int32_t, InitialRows, "initialRows", 30) \
|
||||
X(int32_t, InitialCols, "initialCols", 80) \
|
||||
X(hstring, WordDelimiters, "wordDelimiters", DEFAULT_WORD_DELIMITERS) \
|
||||
@@ -36,38 +49,28 @@ Author(s):
|
||||
X(bool, ShowTitleInTitlebar, "showTerminalTitleInTitlebar", true) \
|
||||
X(bool, ConfirmCloseAllTabs, "confirmCloseAllTabs", true) \
|
||||
X(Model::ThemePair, Theme, "theme") \
|
||||
X(hstring, Language, "language") \
|
||||
X(winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, TabWidthMode, "tabWidthMode", winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::Equal) \
|
||||
X(bool, UseAcrylicInTabRow, "useAcrylicInTabRow", false) \
|
||||
X(bool, ShowTabsInTitlebar, "showTabsInTitlebar", true) \
|
||||
X(bool, InputServiceWarning, "inputServiceWarning", true) \
|
||||
X(winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, "copyFormatting", 0) \
|
||||
X(bool, WarnAboutLargePaste, "largePasteWarning", true) \
|
||||
X(bool, WarnAboutMultiLinePaste, "multiLinePasteWarning", true) \
|
||||
X(Model::LaunchPosition, InitialPosition, "initialPosition", nullptr, nullptr) \
|
||||
X(bool, CenterOnLaunch, "centerOnLaunch", false) \
|
||||
X(Model::FirstWindowPreference, FirstWindowPreference, "firstWindowPreference", FirstWindowPreference::DefaultProfile) \
|
||||
X(Model::LaunchMode, LaunchMode, "launchMode", LaunchMode::DefaultMode) \
|
||||
X(bool, SnapToGridOnResize, "snapToGridOnResize", true) \
|
||||
X(bool, DebugFeaturesEnabled, "debugFeatures", debugFeaturesDefault) \
|
||||
X(bool, StartOnUserLogin, "startOnUserLogin", false) \
|
||||
X(bool, AlwaysOnTop, "alwaysOnTop", false) \
|
||||
X(bool, AutoHideWindow, "autoHideWindow", false) \
|
||||
X(bool, MinimizeToNotificationArea, "minimizeToNotificationArea", false) \
|
||||
X(Model::TabSwitcherMode, TabSwitcherMode, "tabSwitcherMode", Model::TabSwitcherMode::InOrder) \
|
||||
X(bool, DisableAnimations, "disableAnimations", false) \
|
||||
X(hstring, StartupActions, "startupActions", L"") \
|
||||
X(Model::WindowingMode, WindowingBehavior, "windowingBehavior", Model::WindowingMode::UseNew) \
|
||||
X(bool, MinimizeToNotificationArea, "minimizeToNotificationArea", false) \
|
||||
X(bool, AlwaysShowNotificationIcon, "alwaysShowNotificationIcon", false) \
|
||||
X(winrt::Windows::Foundation::Collections::IVector<winrt::hstring>, DisabledProfileSources, "disabledProfileSources", nullptr) \
|
||||
X(bool, ShowAdminShield, "showAdminShield", true) \
|
||||
X(bool, TrimPaste, "trimPaste", true) \
|
||||
X(bool, EnableColorSelection, "experimental.enableColorSelection", false) \
|
||||
X(bool, EnableShellCompletionMenu, "experimental.enableShellCompletionMenu", false) \
|
||||
X(bool, EnableUnfocusedAcrylic, "compatibility.enableUnfocusedAcrylic", true) \
|
||||
X(winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry>, NewTabMenu, "newTabMenu", winrt::single_threaded_vector<Model::NewTabMenuEntry>({ Model::RemainingProfilesEntry{} })) \
|
||||
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
|
||||
X(bool, IsolatedMode, "compatibility.isolatedMode", false) \
|
||||
X(hstring, SearchWebDefaultQueryUrl, "searchWebDefaultQueryUrl", L"https://www.bing.com/search?q=%22%s%22")
|
||||
|
||||
// Also add these settings to:
|
||||
|
||||
@@ -80,6 +80,9 @@
|
||||
<ClInclude Include="GlobalAppSettings.h">
|
||||
<DependentUpon>GlobalAppSettings.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WindowSettings.h">
|
||||
<DependentUpon>GlobalAppSettings.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IInheritable.h" />
|
||||
<ClInclude Include="MTSMSettings.h" />
|
||||
<ClInclude Include="IDynamicProfileGenerator.h" />
|
||||
@@ -165,6 +168,9 @@
|
||||
<ClCompile Include="GlobalAppSettings.cpp">
|
||||
<DependentUpon>GlobalAppSettings.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WindowSettings.cpp">
|
||||
<DependentUpon>GlobalAppSettings.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KeyChordSerialization.cpp">
|
||||
<DependentUpon>KeyChordSerialization.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
|
||||
@@ -50,21 +50,30 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
return { horizAlign, vertAlign };
|
||||
}
|
||||
|
||||
winrt::com_ptr<implementation::TerminalSettings> TerminalSettings::_CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
|
||||
winrt::com_ptr<implementation::TerminalSettings> TerminalSettings::_CreateWithProfileCommon(
|
||||
const Model::CascadiaSettings& appSettings,
|
||||
const Model::WindowSettings& currentWindowSettings,
|
||||
const Model::Profile& profile)
|
||||
{
|
||||
auto settings{ winrt::make_self<TerminalSettings>() };
|
||||
|
||||
const auto globals = appSettings.GlobalSettings();
|
||||
settings->_ApplyProfileSettings(profile);
|
||||
settings->_ApplyGlobalSettings(globals);
|
||||
settings->_ApplyAppearanceSettings(profile.DefaultAppearance(), globals.ColorSchemes(), globals.CurrentTheme());
|
||||
settings->_ApplyWindowSettings(currentWindowSettings);
|
||||
settings->_ApplyAppearanceSettings(profile.DefaultAppearance(),
|
||||
globals.ColorSchemes(),
|
||||
globals.CurrentTheme(currentWindowSettings));
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
Model::TerminalSettings TerminalSettings::CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
|
||||
Model::TerminalSettings TerminalSettings::CreateForPreview(
|
||||
const Model::CascadiaSettings& appSettings,
|
||||
const Model::WindowSettings& currentWindowSettings,
|
||||
const Model::Profile& profile)
|
||||
{
|
||||
const auto settings = _CreateWithProfileCommon(appSettings, profile);
|
||||
const auto settings = _CreateWithProfileCommon(appSettings, currentWindowSettings, profile);
|
||||
settings->UseBackgroundImageForWindow(false);
|
||||
return *settings;
|
||||
}
|
||||
@@ -81,9 +90,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// Return Value:
|
||||
// - A TerminalSettingsCreateResult, which contains a pair of TerminalSettings objects,
|
||||
// one for when the terminal is focused and the other for when the terminal is unfocused
|
||||
Model::TerminalSettingsCreateResult TerminalSettings::CreateWithProfile(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const IKeyBindings& keybindings)
|
||||
Model::TerminalSettingsCreateResult TerminalSettings::CreateWithProfile(
|
||||
const Model::CascadiaSettings& appSettings,
|
||||
const Model::WindowSettings& currentWindowSettings,
|
||||
const Model::Profile& profile,
|
||||
const IKeyBindings& keybindings)
|
||||
{
|
||||
const auto settings = _CreateWithProfileCommon(appSettings, profile);
|
||||
const auto settings = _CreateWithProfileCommon(appSettings, currentWindowSettings, profile);
|
||||
settings->_KeyBindings = keybindings;
|
||||
|
||||
Model::TerminalSettings child{ nullptr };
|
||||
@@ -91,7 +104,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
const auto globals = appSettings.GlobalSettings();
|
||||
auto childImpl = settings->CreateChild();
|
||||
childImpl->_ApplyAppearanceSettings(unfocusedAppearance, globals.ColorSchemes(), globals.CurrentTheme());
|
||||
childImpl->_ApplyAppearanceSettings(unfocusedAppearance, globals.ColorSchemes(), globals.CurrentTheme(currentWindowSettings));
|
||||
child = *childImpl;
|
||||
}
|
||||
|
||||
@@ -116,12 +129,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// Return Value:
|
||||
// - A TerminalSettingsCreateResult object, which contains a pair of TerminalSettings
|
||||
// objects. One for when the terminal is focused and one for when the terminal is unfocused.
|
||||
Model::TerminalSettingsCreateResult TerminalSettings::CreateWithNewTerminalArgs(const CascadiaSettings& appSettings,
|
||||
const NewTerminalArgs& newTerminalArgs,
|
||||
const IKeyBindings& keybindings)
|
||||
Model::TerminalSettingsCreateResult TerminalSettings::CreateWithNewTerminalArgs(
|
||||
const CascadiaSettings& appSettings,
|
||||
const Model::WindowSettings& currentWindowSettings,
|
||||
const NewTerminalArgs& newTerminalArgs,
|
||||
const IKeyBindings& keybindings)
|
||||
{
|
||||
const auto profile = appSettings.GetProfileForArgs(newTerminalArgs);
|
||||
auto settingsPair{ CreateWithProfile(appSettings, profile, keybindings) };
|
||||
const auto profile = appSettings.GetProfileForArgs(newTerminalArgs, currentWindowSettings);
|
||||
auto settingsPair{ CreateWithProfile(appSettings, currentWindowSettings, profile, keybindings) };
|
||||
auto defaultSettings = settingsPair.DefaultSettings();
|
||||
|
||||
if (newTerminalArgs)
|
||||
@@ -342,21 +357,33 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// - globalSettings: the global property values we're applying.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalSettings::_ApplyGlobalSettings(const Model::GlobalAppSettings& globalSettings) noexcept
|
||||
void TerminalSettings::_ApplyGlobalSettings(const Model::GlobalAppSettings& /*globalSettings*/) noexcept
|
||||
{
|
||||
_InitialRows = globalSettings.InitialRows();
|
||||
_InitialCols = globalSettings.InitialCols();
|
||||
// I'm not sure there are any global settings that apply to profiles
|
||||
// anymore, after moving most global settings to be per-window name
|
||||
}
|
||||
|
||||
_WordDelimiters = globalSettings.WordDelimiters();
|
||||
_CopyOnSelect = globalSettings.CopyOnSelect();
|
||||
_FocusFollowMouse = globalSettings.FocusFollowMouse();
|
||||
_ForceFullRepaintRendering = globalSettings.ForceFullRepaintRendering();
|
||||
_SoftwareRendering = globalSettings.SoftwareRendering();
|
||||
_UseBackgroundImageForWindow = globalSettings.UseBackgroundImageForWindow();
|
||||
_ForceVTInput = globalSettings.ForceVTInput();
|
||||
_TrimBlockSelection = globalSettings.TrimBlockSelection();
|
||||
_DetectURLs = globalSettings.DetectURLs();
|
||||
_EnableUnfocusedAcrylic = globalSettings.EnableUnfocusedAcrylic();
|
||||
// Method Description:
|
||||
// - Applies appropriate settings from the globals into the TerminalSettings object.
|
||||
// Arguments:
|
||||
// - globalSettings: the global property values we're applying.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalSettings::_ApplyWindowSettings(const Model::WindowSettings& windowSettings) noexcept
|
||||
{
|
||||
_InitialRows = windowSettings.InitialRows();
|
||||
_InitialCols = windowSettings.InitialCols();
|
||||
|
||||
_WordDelimiters = windowSettings.WordDelimiters();
|
||||
_CopyOnSelect = windowSettings.CopyOnSelect();
|
||||
_FocusFollowMouse = windowSettings.FocusFollowMouse();
|
||||
_ForceFullRepaintRendering = windowSettings.ForceFullRepaintRendering();
|
||||
_SoftwareRendering = windowSettings.SoftwareRendering();
|
||||
_UseBackgroundImageForWindow = windowSettings.UseBackgroundImageForWindow();
|
||||
_ForceVTInput = windowSettings.ForceVTInput();
|
||||
_TrimBlockSelection = windowSettings.TrimBlockSelection();
|
||||
_DetectURLs = windowSettings.DetectURLs();
|
||||
_EnableUnfocusedAcrylic = windowSettings.EnableUnfocusedAcrylic();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -56,13 +56,15 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
TerminalSettings() = default;
|
||||
|
||||
static Model::TerminalSettings CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile);
|
||||
static Model::TerminalSettings CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::WindowSettings& currentWindowSettings, const Model::Profile& profile);
|
||||
|
||||
static Model::TerminalSettingsCreateResult CreateWithProfile(const Model::CascadiaSettings& appSettings,
|
||||
const Model::WindowSettings& currentWindowSettings,
|
||||
const Model::Profile& profile,
|
||||
const Control::IKeyBindings& keybindings);
|
||||
|
||||
static Model::TerminalSettingsCreateResult CreateWithNewTerminalArgs(const Model::CascadiaSettings& appSettings,
|
||||
const Model::WindowSettings& currentWindowSettings,
|
||||
const Model::NewTerminalArgs& newTerminalArgs,
|
||||
const Control::IKeyBindings& keybindings);
|
||||
|
||||
@@ -171,10 +173,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
std::optional<std::array<Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE>> _ColorTable;
|
||||
std::span<Microsoft::Terminal::Core::Color> _getColorTableImpl();
|
||||
|
||||
static winrt::com_ptr<implementation::TerminalSettings> _CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile);
|
||||
static winrt::com_ptr<implementation::TerminalSettings> _CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::WindowSettings& currentWindowSettings, const Model::Profile& profile);
|
||||
void _ApplyProfileSettings(const Model::Profile& profile);
|
||||
|
||||
void _ApplyGlobalSettings(const Model::GlobalAppSettings& globalSettings) noexcept;
|
||||
void _ApplyWindowSettings(const Model::WindowSettings& windowSettings) noexcept;
|
||||
void _ApplyAppearanceSettings(const Microsoft::Terminal::Settings::Model::IAppearanceConfig& appearance,
|
||||
const Windows::Foundation::Collections::IMapView<hstring, Microsoft::Terminal::Settings::Model::ColorScheme>& schemes,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::Theme currentTheme);
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
Windows.Foundation.Collections.IMap<String COMMA String> EnvironmentVariables;
|
||||
|
||||
static TerminalSettings CreateForPreview(CascadiaSettings appSettings, Profile profile);
|
||||
static TerminalSettingsCreateResult CreateWithProfile(CascadiaSettings appSettings, Profile profile, Microsoft.Terminal.Control.IKeyBindings keybindings);
|
||||
static TerminalSettingsCreateResult CreateWithNewTerminalArgs(CascadiaSettings appSettings, NewTerminalArgs newTerminalArgs, Microsoft.Terminal.Control.IKeyBindings keybindings);
|
||||
static TerminalSettings CreateForPreview(CascadiaSettings appSettings, WindowSettings windowSettings, Profile profile);
|
||||
static TerminalSettingsCreateResult CreateWithProfile(CascadiaSettings appSettings, WindowSettings windowSettings, Profile profile, Microsoft.Terminal.Control.IKeyBindings keybindings);
|
||||
static TerminalSettingsCreateResult CreateWithNewTerminalArgs(CascadiaSettings appSettings, WindowSettings windowSettings, NewTerminalArgs newTerminalArgs, Microsoft.Terminal.Control.IKeyBindings keybindings);
|
||||
|
||||
void ApplyColorScheme(ColorScheme scheme);
|
||||
|
||||
|
||||
159
src/cascadia/TerminalSettingsModel/WindowSettings.cpp
Normal file
159
src/cascadia/TerminalSettingsModel/WindowSettings.cpp
Normal file
@@ -0,0 +1,159 @@
|
||||
;
|
||||
;
|
||||
; // Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "WindowSettings.h"
|
||||
#include "../../types/inc/Utils.hpp"
|
||||
#include "JsonUtils.h"
|
||||
#include "KeyChordSerialization.h"
|
||||
#include "../inc/WindowingBehavior.h"
|
||||
|
||||
#include "WindowSettings.g.cpp"
|
||||
|
||||
#include "ProfileEntry.h"
|
||||
#include "FolderEntry.h"
|
||||
#include "MatchProfilesEntry.h"
|
||||
|
||||
using namespace ::Microsoft::Console;
|
||||
using namespace ::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model::implementation;
|
||||
using namespace winrt::Microsoft::Terminal::Settings;
|
||||
|
||||
using namespace winrt::Microsoft::UI::Xaml::Controls;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::Foundation::Collections;
|
||||
|
||||
static constexpr std::string_view NameKey{ "name" };
|
||||
static constexpr std::string_view ThemeKey{ "theme" };
|
||||
static constexpr std::string_view DefaultProfileKey{ "defaultProfile" };
|
||||
static constexpr std::string_view LegacyUseTabSwitcherModeKey{ "useTabSwitcher" };
|
||||
|
||||
// Method Description:
|
||||
// - Copies any extraneous data from the parent before completing a CreateChild call
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void WindowSettings::_FinalizeInheritance()
|
||||
{
|
||||
for (const auto& parent : _parents)
|
||||
{
|
||||
parent;
|
||||
|
||||
// _actionMap->AddLeastImportantParent(parent->_actionMap);
|
||||
// _keybindingsWarnings.insert(_keybindingsWarnings.end(), parent->_keybindingsWarnings.begin(), parent->_keybindingsWarnings.end());
|
||||
// for (const auto& [k, v] : parent->_colorSchemes)
|
||||
// {
|
||||
// if (!_colorSchemes.HasKey(k))
|
||||
// {
|
||||
// _colorSchemes.Insert(k, v);
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (const auto& [k, v] : parent->_themes)
|
||||
// {
|
||||
// if (!_themes.HasKey(k))
|
||||
// {
|
||||
// _themes.Insert(k, v);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
winrt::com_ptr<WindowSettings> WindowSettings::Copy() const
|
||||
{
|
||||
auto globals{ winrt::make_self<WindowSettings>() };
|
||||
|
||||
globals->_UnparsedDefaultProfile = _UnparsedDefaultProfile;
|
||||
globals->_defaultProfile = _defaultProfile;
|
||||
|
||||
#define WINDOW_SETTINGS_COPY(type, name, jsonKey, ...) \
|
||||
globals->_##name = _##name;
|
||||
MTSM_WINDOW_SETTINGS(WINDOW_SETTINGS_COPY)
|
||||
#undef WINDOW_SETTINGS_COPY
|
||||
|
||||
for (const auto& parent : _parents)
|
||||
{
|
||||
globals->AddLeastImportantParent(parent->Copy());
|
||||
}
|
||||
return globals;
|
||||
}
|
||||
|
||||
#pragma region DefaultProfile
|
||||
|
||||
void WindowSettings::DefaultProfile(const winrt::guid& defaultProfile) noexcept
|
||||
{
|
||||
_defaultProfile = defaultProfile;
|
||||
_UnparsedDefaultProfile = Utils::GuidToString(defaultProfile);
|
||||
}
|
||||
|
||||
winrt::guid WindowSettings::DefaultProfile() const
|
||||
{
|
||||
return _defaultProfile;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
// Method Description:
|
||||
// - Create a new instance of this class from a serialized JsonObject.
|
||||
// Arguments:
|
||||
// - json: an object which should be a serialization of a WindowSettings object.
|
||||
// Return Value:
|
||||
// - a new WindowSettings instance created from the values in `json`
|
||||
winrt::com_ptr<WindowSettings> WindowSettings::FromJson(const Json::Value& json)
|
||||
{
|
||||
auto result = winrt::make_self<WindowSettings>();
|
||||
result->LayerJson(json);
|
||||
return result;
|
||||
}
|
||||
|
||||
void WindowSettings::LayerJson(const Json::Value& json)
|
||||
{
|
||||
JsonUtils::GetValueForKey(json, NameKey, Name);
|
||||
|
||||
// sneaky: is the name _quake? then set up some default window settings here:
|
||||
if (Name() == QuakeWindowName)
|
||||
{
|
||||
InitializeForQuakeMode();
|
||||
}
|
||||
|
||||
JsonUtils::GetValueForKey(json, DefaultProfileKey, _UnparsedDefaultProfile);
|
||||
// GH#8076 - when adding enum values to this key, we also changed it from
|
||||
// "useTabSwitcher" to "tabSwitcherMode". Continue supporting
|
||||
// "useTabSwitcher", but prefer "tabSwitcherMode"
|
||||
JsonUtils::GetValueForKey(json, LegacyUseTabSwitcherModeKey, _TabSwitcherMode);
|
||||
|
||||
#define WINDOW_SETTINGS_LAYER_JSON(type, name, jsonKey, ...) \
|
||||
JsonUtils::GetValueForKey(json, jsonKey, _##name);
|
||||
MTSM_WINDOW_SETTINGS(WINDOW_SETTINGS_LAYER_JSON)
|
||||
#undef WINDOW_SETTINGS_LAYER_JSON
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Create a new serialized JsonObject from an instance of this class
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - the JsonObject representing this instance
|
||||
Json::Value WindowSettings::ToJson() const
|
||||
{
|
||||
Json::Value json{ Json::ValueType::objectValue };
|
||||
|
||||
JsonUtils::SetValueForKey(json, DefaultProfileKey, _UnparsedDefaultProfile);
|
||||
|
||||
#define WINDOW_SETTINGS_TO_JSON(type, name, jsonKey, ...) \
|
||||
JsonUtils::SetValueForKey(json, jsonKey, _##name);
|
||||
MTSM_WINDOW_SETTINGS(WINDOW_SETTINGS_TO_JSON)
|
||||
#undef WINDOW_SETTINGS_TO_JSON
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
// Set up anything that we need that's quake-mode specific.
|
||||
void WindowSettings::InitializeForQuakeMode()
|
||||
{
|
||||
LaunchMode(LaunchMode::FocusMode);
|
||||
}
|
||||
69
src/cascadia/TerminalSettingsModel/WindowSettings.h
Normal file
69
src/cascadia/TerminalSettingsModel/WindowSettings.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- WindowSettings.h
|
||||
|
||||
Abstract:
|
||||
- This class encapsulates all of the settings that are specific to a single
|
||||
window. Broader than Profile settings (which are more like, per-pane
|
||||
settings). Different windows can have different settings for things like
|
||||
Theme, default profile, launch mode, etc.
|
||||
|
||||
Author(s):
|
||||
- Mike Griese - Sept 2023
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
#include "WindowSettings.g.h"
|
||||
#include "IInheritable.h"
|
||||
#include "MTSMSettings.h"
|
||||
|
||||
#include "TerminalSettingsSerializationHelpers.h"
|
||||
#include "ColorScheme.h"
|
||||
#include "Theme.h"
|
||||
#include "NewTabMenuEntry.h"
|
||||
#include "RemainingProfilesEntry.h"
|
||||
|
||||
// fwdecl unittest classes
|
||||
namespace SettingsModelLocalTests
|
||||
{
|
||||
class DeserializationTests;
|
||||
class ColorSchemeTests;
|
||||
};
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
struct WindowSettings : WindowSettingsT<WindowSettings>, IInheritable<WindowSettings>
|
||||
{
|
||||
public:
|
||||
void _FinalizeInheritance() override;
|
||||
com_ptr<WindowSettings> Copy() const;
|
||||
|
||||
static com_ptr<WindowSettings> FromJson(const Json::Value& json);
|
||||
void LayerJson(const Json::Value& json);
|
||||
|
||||
Json::Value ToJson() const;
|
||||
|
||||
void InitializeForQuakeMode();
|
||||
|
||||
// This DefaultProfile() setter is called by CascadiaSettings,
|
||||
// when it parses UnparsedDefaultProfile in _finalizeSettings().
|
||||
void DefaultProfile(const guid& defaultProfile) noexcept;
|
||||
guid DefaultProfile() const;
|
||||
|
||||
til::property<winrt::hstring> Name;
|
||||
|
||||
INHERITABLE_SETTING(Model::WindowSettings, hstring, UnparsedDefaultProfile, L"");
|
||||
|
||||
#define WINDOW_SETTINGS_INITIALIZE(type, name, jsonKey, ...) \
|
||||
INHERITABLE_SETTING(Model::WindowSettings, type, name, ##__VA_ARGS__)
|
||||
MTSM_WINDOW_SETTINGS(WINDOW_SETTINGS_INITIALIZE)
|
||||
#undef WINDOW_SETTINGS_INITIALIZE
|
||||
|
||||
private:
|
||||
winrt::guid _defaultProfile;
|
||||
};
|
||||
}
|
||||
@@ -58,6 +58,7 @@ TRACELOGGING_DECLARE_PROVIDER(g_hSettingsModelProvider);
|
||||
|
||||
// Manually include til after we include Windows.Foundation to give it winrt superpowers
|
||||
#include "til.h"
|
||||
#include <til/winrt.h>
|
||||
|
||||
#include <til/mutex.h>
|
||||
#include <til/throttled_func.h>
|
||||
|
||||
@@ -1108,7 +1108,7 @@ void _frameColorHelper(const HWND h, const COLORREF color)
|
||||
|
||||
void AppHost::_updateTheme()
|
||||
{
|
||||
auto theme = _appLogic.Theme();
|
||||
auto theme = _windowLogic.Theme();
|
||||
|
||||
_window->OnApplicationThemeChanged(theme.RequestedTheme());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user