Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for a profile to specify an "unfocused" appearance #8392

Merged
103 commits merged into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
c6432b6
add object on Core side
PankajBhojwani Nov 20, 2020
f806011
object in settings model side
PankajBhojwani Nov 24, 2020
5aa1e66
applib side object
PankajBhojwani Nov 24, 2020
c423e11
barebones prototype
PankajBhojwani Nov 24, 2020
8f8e6e7
renaming
PankajBhojwani Nov 30, 2020
f4dd69a
cursor shape
PankajBhojwani Nov 30, 2020
235bbd7
background image works now
PankajBhojwani Dec 1, 2020
dc8328d
deduplicate code: UpdateSettings now calls UpdateAppearance
PankajBhojwani Dec 2, 2020
d3ad801
spell, Cl check
PankajBhojwani Dec 2, 2020
43c6204
IAppearanceConfig interface in settings model side, color scheme gets…
PankajBhojwani Dec 2, 2020
2960ba2
background image parameters
PankajBhojwani Dec 2, 2020
bc12378
actually use the image params
PankajBhojwani Dec 2, 2020
34621c1
functions for update settings/appearance from ui settings
PankajBhojwani Dec 2, 2020
45a9718
conflict
PankajBhojwani Dec 2, 2020
d9fbe56
update with the new converged alignment
PankajBhojwani Dec 3, 2020
9e1a9f9
IControl/CoreAppearance
PankajBhojwani Dec 5, 2020
a118fe7
inheritance step 1?
PankajBhojwani Dec 7, 2020
90025ec
placeholder inheritance
PankajBhojwani Dec 9, 2020
e0244d5
friend struct works
PankajBhojwani Dec 9, 2020
95e679c
not experimental
PankajBhojwani Dec 9, 2020
6688c3c
color scheme fix
PankajBhojwani Dec 9, 2020
9eba7ab
dont update appearance if no unfocused config
PankajBhojwani Dec 11, 2020
698cf41
add comments to code
PankajBhojwani Dec 11, 2020
8194aca
update to mock term settings
PankajBhojwani Dec 11, 2020
8b64425
begin
PankajBhojwani Dec 16, 2020
403646f
everything updates except color scheme?
PankajBhojwani Dec 17, 2020
7b5e04e
color scheme fix
PankajBhojwani Dec 17, 2020
21139f5
dead code
PankajBhojwani Dec 17, 2020
7079e60
remove unnecessary comment
PankajBhojwani Dec 17, 2020
1fc3e8b
format
PankajBhojwani Dec 17, 2020
5151a7f
Merge branch 'main' of https://github.com/microsoft/terminal into dev…
PankajBhojwani Dec 18, 2020
25b31d4
conflicts
PankajBhojwani Dec 18, 2020
811f796
changing base branch conflicts
PankajBhojwani Dec 18, 2020
bd6fc9f
updates to get it working again after merge
PankajBhojwani Dec 18, 2020
363307b
AppearanceConfig -> IAppearanceConfig
PankajBhojwani Dec 18, 2020
155f522
pass unfocused appearance as another IControlSettings
PankajBhojwani Dec 19, 2020
d45439f
remove app appearance config
PankajBhojwani Dec 21, 2020
b3aa5dc
remove another reference
PankajBhojwani Dec 21, 2020
e241ade
remove IControlAppearance object from IControlSettings
PankajBhojwani Dec 21, 2020
7509ed0
newline
PankajBhojwani Dec 21, 2020
e27a359
ok
PankajBhojwani Dec 21, 2020
8d2c583
Merge branch 'main' of https://github.com/microsoft/terminal into dev…
PankajBhojwani Jan 4, 2021
a288001
pragma warning
PankajBhojwani Jan 4, 2021
ceb1d00
conflict
PankajBhojwani Jan 4, 2021
b57ee23
color table fix
PankajBhojwani Jan 5, 2021
6ac4249
remove import
PankajBhojwani Jan 8, 2021
ab36124
fix comment
PankajBhojwani Jan 8, 2021
f5974b3
conflict
PankajBhojwani Jan 15, 2021
b9ef9f1
Merge branch 'main' of https://github.com/microsoft/terminal into dev…
PankajBhojwani Jan 22, 2021
fb63251
conflict
PankajBhojwani Jan 22, 2021
ae81a4a
conflicts
PankajBhojwani Feb 8, 2021
422a785
rename unfocusedConfig to unfocusedAppearance
PankajBhojwani Feb 8, 2021
37b219a
update test
PankajBhojwani Feb 9, 2021
d150eda
cursor height
PankajBhojwani Feb 9, 2021
2cbcd75
implement to json and copy appearance
PankajBhojwani Feb 10, 2021
e08fabe
copy settings and tojson
PankajBhojwani Feb 11, 2021
8e5522e
const, has value
PankajBhojwani Feb 12, 2021
4f63f8d
copy appearance works now
PankajBhojwani Feb 12, 2021
e106314
Merge branch 'main' of https://github.com/microsoft/terminal into dev…
PankajBhojwani Feb 17, 2021
4bbc653
fix conflicts
PankajBhojwani Feb 26, 2021
bfabaec
update macro
PankajBhojwani Feb 26, 2021
99132d2
address comments
PankajBhojwani Feb 26, 2021
8d577c0
fix tests
PankajBhojwani Mar 1, 2021
9ca0773
abstract
PankajBhojwani Mar 2, 2021
1d126e8
const
PankajBhojwani Mar 4, 2021
acec746
decltype comment
PankajBhojwani Mar 4, 2021
10641af
first step for default appearance
PankajBhojwani Mar 8, 2021
309f449
aaaa
PankajBhojwani Mar 12, 2021
32dc8c6
okay just some cleanup left I think
PankajBhojwani Mar 12, 2021
77db627
merge main, fix conflict
PankajBhojwani Mar 15, 2021
4d1cdc9
?
PankajBhojwani Mar 15, 2021
b0cbf66
pending discussion
PankajBhojwani Mar 16, 2021
0d62955
build settings does the work
PankajBhojwani Mar 16, 2021
f64646e
fix tests
PankajBhojwani Mar 16, 2021
c7803be
still gotta fix conflicts
PankajBhojwani Mar 17, 2021
79d3d3c
struct added
PankajBhojwani Mar 18, 2021
42ac24c
struct
PankajBhojwani Mar 19, 2021
c6b72b4
fix update settings
PankajBhojwani Mar 19, 2021
45447e1
conflict
PankajBhojwani Mar 19, 2021
521e0f0
naming conflicts
PankajBhojwani Mar 19, 2021
282dfec
retro and pixel to appearance
PankajBhojwani Mar 19, 2021
e857304
format
PankajBhojwani Mar 19, 2021
95ab9af
nits
PankajBhojwani Mar 23, 2021
5c11434
deduplicate
PankajBhojwani Mar 23, 2021
edc0fbe
validate
PankajBhojwani Mar 23, 2021
d1335d1
oops
PankajBhojwani Mar 23, 2021
12f2ff9
cleanup
PankajBhojwani Mar 23, 2021
8fd094c
address comments
PankajBhojwani Mar 26, 2021
858a723
add/update comments
PankajBhojwani Mar 29, 2021
581e769
remove constructor from idl
PankajBhojwani Mar 29, 2021
6b833d0
source profile
PankajBhojwani Mar 29, 2021
79039dd
conflict
PankajBhojwani Mar 30, 2021
112dcf5
formta
PankajBhojwani Mar 30, 2021
27805e4
insert parent helper
PankajBhojwani Mar 30, 2021
5ac87cd
schema
PankajBhojwani Mar 31, 2021
61dcf77
1 return
PankajBhojwani Apr 1, 2021
af0b227
add all parents
PankajBhojwani Apr 1, 2021
40ef35f
more comments
PankajBhojwani Apr 1, 2021
9fa647e
conflict
PankajBhojwani Apr 2, 2021
822fefe
mock term
PankajBhojwani Apr 2, 2021
d04c557
address nits
PankajBhojwani Apr 5, 2021
e2130e6
move lock, initialized check
PankajBhojwani Apr 7, 2021
0089065
remove update appearance call
PankajBhojwani Apr 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,117 @@
}
]
},
"AppearanceConfig": {
"properties": {
"colorScheme": {
"description": "The name of a color scheme to use when unfocused.",
"type": "string"
},
"foreground": {
"$ref": "#/definitions/Color",
"default": "#cccccc",
"description": "Sets the text color when unfocused. Overrides \"foreground\" from the color scheme. Uses hex color format: \"#rrggbb\".",
"type": ["string", "null"]
},
PankajBhojwani marked this conversation as resolved.
Show resolved Hide resolved
"background": {
"$ref": "#/definitions/Color",
"default": "#0c0c0c",
"description": "Sets the background color of the text when unfocused. Overrides \"background\" from the color scheme. Uses hex color format: \"#rrggbb\".",
"type": ["string", "null"]
},
"selectionBackground": {
"oneOf": [
{"$ref": "#/definitions/Color"},
{ "type": "null" }
],
"description": "Sets the background color of selected text when unfocused. Overrides selectionBackground set in the color scheme. Uses hex color format: \"#rrggbb\"."
},
"cursorColor": {
"oneOf": [
{ "$ref": "#/definitions/Color" },
{"type": "null"}
],
"description": "Sets the color of the cursor when unfocused. Overrides the cursor color from the color scheme. Uses hex color format: \"#rrggbb\"."
},
"cursorShape": {
"default": "bar",
"description": "Sets the shape of the cursor when unfocused. Possible values:\n -\"bar\" ( ┃, default )\n -\"doubleUnderscore\" ( ‗ )\n -\"emptyBox\" ( ▯ )\n -\"filledBox\" ( █ )\n -\"underscore\" ( ▁ )\n -\"vintage\" ( ▃ )",
"enum": [
"bar",
"doubleUnderscore",
"emptyBox",
"filledBox",
"underscore",
"vintage"
],
"type": "string"
},
"cursorHeight": {
"description": "Sets the percentage height of the cursor (when unfocused) starting from the bottom. Only works when cursorShape is set to \"vintage\". Accepts values from 1-100.",
"maximum": 100,
"minimum": 1,
"type": ["integer","null"],
"default": 25
},
"backgroundImage": {
"description": "Sets the file location of the image to draw over the window background when unfocused.",
"oneOf": [
{
"type": ["string", null]
},
{
"enum": [
"desktopWallpaper"
]
}
],
"type": [ "string", "null" ]
},
"backgroundImageOpacity": {
"default": 1.0,
"description": "Sets the transparency of the background image when unfocused. Accepts floating point values from 0-1.",
"maximum": 1.0,
"minimum": 0.0,
"type": "number"
},
"backgroundImageStretchMode": {
"default": "uniformToFill",
"description": "Sets how the background image is resized to fill the window when unfocused.",
"enum": [
"fill",
"none",
"uniform",
"uniformToFill"
],
"type": "string"
},
"backgroundImageAlignment": {
"default": "center",
"enum": [
"bottom",
"bottomLeft",
"bottomRight",
"center",
"left",
"right",
"top",
"topLeft",
"topRight"
],
"description": "Sets how the background image aligns to the boundaries of the window when unfocused. Possible values: \"center\", \"left\", \"top\", \"right\", \"bottom\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\"",
"type": "string"
},
"experimental.retroTerminalEffect": {
"description": "When set to true, enable retro terminal effects when unfocused. This is an experimental feature, and its continued existence is not guaranteed.",
"type": "boolean"
},
"experimental.pixelShaderPath": {
"description": "Use to set a path to a pixel shader to use with the Terminal when unfocused. Overrides `experimental.retroTerminalEffect`. This is an experimental feature, and its continued existence is not guaranteed.",
"type": "string"
}
},
"type": "object"
},
"ProfileGuid": {
"default": "{}",
"pattern": "^\\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\}$",
Expand Down Expand Up @@ -962,6 +1073,11 @@
"description": "Sets the background color of the text. Overrides \"background\" from the color scheme. Uses hex color format: \"#rrggbb\".",
"type": ["string", "null"]
},
"unfocusedAppearance": {
"$ref": "#/definitions/AppearanceConfig",
"description": "Sets the appearance of the terminal when it is unfocused.",
"type": ["object", "null"]
},
"backgroundImage": {
"description": "Sets the file location of the image to draw over the window background.",
"oneOf": [
Expand Down
20 changes: 10 additions & 10 deletions src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,34 +338,34 @@ namespace SettingsModelLocalTests

// verify profile defaults
Log::Comment(L"Profile Defaults");
VERIFY_ARE_EQUAL(newName, settings->ProfileDefaults().ColorSchemeName());
VERIFY_IS_TRUE(settings->ProfileDefaults().HasColorSchemeName());
VERIFY_ARE_EQUAL(newName, settings->ProfileDefaults().DefaultAppearance().ColorSchemeName());
VERIFY_IS_TRUE(settings->ProfileDefaults().DefaultAppearance().HasColorSchemeName());

// verify all other profiles
const auto& profiles{ settings->AllProfiles() };
{
const auto& prof{ profiles.GetAt(0) };
Log::Comment(prof.Name().c_str());
VERIFY_ARE_EQUAL(newName, prof.ColorSchemeName());
VERIFY_IS_TRUE(prof.HasColorSchemeName());
VERIFY_ARE_EQUAL(newName, prof.DefaultAppearance().ColorSchemeName());
VERIFY_IS_TRUE(prof.DefaultAppearance().HasColorSchemeName());
}
{
const auto& prof{ profiles.GetAt(1) };
Log::Comment(prof.Name().c_str());
VERIFY_ARE_EQUAL(newName, prof.ColorSchemeName());
VERIFY_IS_TRUE(prof.HasColorSchemeName());
VERIFY_ARE_EQUAL(newName, prof.DefaultAppearance().ColorSchemeName());
VERIFY_IS_TRUE(prof.DefaultAppearance().HasColorSchemeName());
}
{
const auto& prof{ profiles.GetAt(2) };
Log::Comment(prof.Name().c_str());
VERIFY_ARE_EQUAL(newName, prof.ColorSchemeName());
VERIFY_IS_FALSE(prof.HasColorSchemeName());
VERIFY_ARE_EQUAL(newName, prof.DefaultAppearance().ColorSchemeName());
VERIFY_IS_FALSE(prof.DefaultAppearance().HasColorSchemeName());
}
{
const auto& prof{ profiles.GetAt(3) };
Log::Comment(prof.Name().c_str());
VERIFY_ARE_EQUAL(L"Scheme 2", prof.ColorSchemeName());
VERIFY_IS_TRUE(prof.HasColorSchemeName());
VERIFY_ARE_EQUAL(L"Scheme 2", prof.DefaultAppearance().ColorSchemeName());
VERIFY_IS_TRUE(prof.DefaultAppearance().HasColorSchemeName());
}
}
}
18 changes: 9 additions & 9 deletions src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,9 +1311,9 @@ namespace SettingsModelLocalTests
VERIFY_ARE_EQUAL(3u, settings->_allProfiles.Size());
VERIFY_ARE_EQUAL(2u, settings->_globals->ColorSchemes().Size());

VERIFY_ARE_EQUAL(L"schemeOne", settings->_allProfiles.GetAt(0).ColorSchemeName());
VERIFY_ARE_EQUAL(L"InvalidSchemeName", settings->_allProfiles.GetAt(1).ColorSchemeName());
VERIFY_ARE_EQUAL(L"Campbell", settings->_allProfiles.GetAt(2).ColorSchemeName());
VERIFY_ARE_EQUAL(L"schemeOne", settings->_allProfiles.GetAt(0).DefaultAppearance().ColorSchemeName());
VERIFY_ARE_EQUAL(L"InvalidSchemeName", settings->_allProfiles.GetAt(1).DefaultAppearance().ColorSchemeName());
VERIFY_ARE_EQUAL(L"Campbell", settings->_allProfiles.GetAt(2).DefaultAppearance().ColorSchemeName());

settings->_ValidateAllSchemesExist();

Expand All @@ -1323,9 +1323,9 @@ namespace SettingsModelLocalTests
VERIFY_ARE_EQUAL(3u, settings->_allProfiles.Size());
VERIFY_ARE_EQUAL(2u, settings->_globals->ColorSchemes().Size());

VERIFY_ARE_EQUAL(L"schemeOne", settings->_allProfiles.GetAt(0).ColorSchemeName());
VERIFY_ARE_EQUAL(L"Campbell", settings->_allProfiles.GetAt(1).ColorSchemeName());
VERIFY_ARE_EQUAL(L"Campbell", settings->_allProfiles.GetAt(2).ColorSchemeName());
VERIFY_ARE_EQUAL(L"schemeOne", settings->_allProfiles.GetAt(0).DefaultAppearance().ColorSchemeName());
VERIFY_ARE_EQUAL(L"Campbell", settings->_allProfiles.GetAt(1).DefaultAppearance().ColorSchemeName());
VERIFY_ARE_EQUAL(L"Campbell", settings->_allProfiles.GetAt(2).DefaultAppearance().ColorSchemeName());
}

void DeserializationTests::ValidateColorSchemeInCommands()
Expand Down Expand Up @@ -1543,7 +1543,7 @@ namespace SettingsModelLocalTests
settings->_ParseJsonString(settingsJson, false);
settings->LayerJson(settings->_userSettings);
VERIFY_ARE_NOT_EQUAL(0u, settings->_allProfiles.Size());
VERIFY_ARE_EQUAL(expectedPath, settings->_allProfiles.GetAt(0).ExpandedBackgroundImagePath());
VERIFY_ARE_EQUAL(expectedPath, settings->_allProfiles.GetAt(0).DefaultAppearance().ExpandedBackgroundImagePath());
}
void DeserializationTests::TestProfileBackgroundImageWithDesktopWallpaper()
{
Expand All @@ -1564,8 +1564,8 @@ namespace SettingsModelLocalTests
auto settings = winrt::make_self<implementation::CascadiaSettings>();
settings->_ParseJsonString(settingsJson, false);
settings->LayerJson(settings->_userSettings);
VERIFY_ARE_EQUAL(expectedBackgroundImagePath, settings->_allProfiles.GetAt(0).BackgroundImagePath());
VERIFY_ARE_NOT_EQUAL(expectedBackgroundImagePath, settings->_allProfiles.GetAt(0).ExpandedBackgroundImagePath());
VERIFY_ARE_EQUAL(expectedBackgroundImagePath, settings->_allProfiles.GetAt(0).DefaultAppearance().BackgroundImagePath());
VERIFY_ARE_NOT_EQUAL(expectedBackgroundImagePath, settings->_allProfiles.GetAt(0).DefaultAppearance().ExpandedBackgroundImagePath());
}
void DeserializationTests::TestCloseOnExitParsing()
{
Expand Down
36 changes: 18 additions & 18 deletions src/cascadia/LocalTests_SettingsModel/ProfileTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ namespace SettingsModelLocalTests
const auto profile2Json = VerifyParseSucceeded(profile2String);

auto profile0 = implementation::Profile::FromJson(profile0Json);
VERIFY_IS_NOT_NULL(profile0->Foreground());
VERIFY_ARE_EQUAL(til::color(0, 0, 0), til::color{ profile0->Foreground().Value() });
VERIFY_IS_NOT_NULL(profile0->DefaultAppearance().Foreground());
VERIFY_ARE_EQUAL(til::color(0, 0, 0), til::color{ profile0->DefaultAppearance().Foreground().Value() });

VERIFY_IS_NOT_NULL(profile0->Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile0->Background().Value() });
VERIFY_IS_NOT_NULL(profile0->DefaultAppearance().Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile0->DefaultAppearance().Background().Value() });

VERIFY_IS_NOT_NULL(profile0->SelectionBackground());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile0->SelectionBackground().Value() });
VERIFY_IS_NOT_NULL(profile0->DefaultAppearance().SelectionBackground());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile0->DefaultAppearance().SelectionBackground().Value() });

VERIFY_ARE_EQUAL(L"profile0", profile0->Name());

Expand All @@ -135,14 +135,14 @@ namespace SettingsModelLocalTests
auto profile1{ profile0->CreateChild() };
profile1->LayerJson(profile1Json);

VERIFY_IS_NOT_NULL(profile1->Foreground());
VERIFY_ARE_EQUAL(til::color(2, 2, 2), til::color{ profile1->Foreground().Value() });
VERIFY_IS_NOT_NULL(profile1->DefaultAppearance().Foreground());
VERIFY_ARE_EQUAL(til::color(2, 2, 2), til::color{ profile1->DefaultAppearance().Foreground().Value() });

VERIFY_IS_NOT_NULL(profile1->Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile1->Background().Value() });
VERIFY_IS_NOT_NULL(profile1->DefaultAppearance().Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile1->DefaultAppearance().Background().Value() });

VERIFY_IS_NOT_NULL(profile1->Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile1->Background().Value() });
VERIFY_IS_NOT_NULL(profile1->DefaultAppearance().Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile1->DefaultAppearance().Background().Value() });

VERIFY_ARE_EQUAL(L"profile1", profile1->Name());

Expand All @@ -154,14 +154,14 @@ namespace SettingsModelLocalTests
auto profile2{ profile1->CreateChild() };
profile2->LayerJson(profile2Json);

VERIFY_IS_NOT_NULL(profile2->Foreground());
VERIFY_ARE_EQUAL(til::color(3, 3, 3), til::color{ profile2->Foreground().Value() });
VERIFY_IS_NOT_NULL(profile2->DefaultAppearance().Foreground());
VERIFY_ARE_EQUAL(til::color(3, 3, 3), til::color{ profile2->DefaultAppearance().Foreground().Value() });

VERIFY_IS_NOT_NULL(profile2->Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile2->Background().Value() });
VERIFY_IS_NOT_NULL(profile2->DefaultAppearance().Background());
VERIFY_ARE_EQUAL(til::color(1, 1, 1), til::color{ profile2->DefaultAppearance().Background().Value() });

VERIFY_IS_NOT_NULL(profile2->SelectionBackground());
VERIFY_ARE_EQUAL(til::color(2, 2, 2), til::color{ profile2->SelectionBackground().Value() });
VERIFY_IS_NOT_NULL(profile2->DefaultAppearance().SelectionBackground());
VERIFY_ARE_EQUAL(til::color(2, 2, 2), til::color{ profile2->DefaultAppearance().SelectionBackground().Value() });

VERIFY_ARE_EQUAL(L"profile2", profile2->Name());

Expand Down
Loading