From 4b439cf290d74caf61041803846df81a75f28919 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 18 Sep 2019 15:37:34 -0500 Subject: [PATCH] Add `hidden` to the defaults, the userDefaults, and the autogenerated stubs (#2801) Fixes #2795 --- doc/cascadia/SettingsSchema.md | 9 +++++---- src/cascadia/TerminalApp/Profile.cpp | 6 +++++- src/cascadia/TerminalApp/defaults.json | 2 ++ src/cascadia/TerminalApp/userDefaults.json | 6 ++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/doc/cascadia/SettingsSchema.md b/doc/cascadia/SettingsSchema.md index 116be007d60..b68d35d89a4 100644 --- a/doc/cascadia/SettingsSchema.md +++ b/doc/cascadia/SettingsSchema.md @@ -29,6 +29,7 @@ Properties listed below are specific to each unique profile. | `fontFace` | _Required_ | String | `Consolas` | Name of the font face used in the profile. We will try to fallback to Consolas if this can't be found or is invalid. | | `fontSize` | _Required_ | Integer | `12` | Sets the font size. | | `guid` | _Required_ | String | | Unique identifier of the profile. Written in registry format: `"{00000000-0000-0000-0000-000000000000}"`. | +| `hidden` | Optional | Boolean | `false` | If set to true, the profile will not appear in the list of profiles. This can be used to hide default profiles and dynamicially generated profiles, while leaving them in your settings file. | | `historySize` | _Required_ | Integer | `9001` | The number of lines above the ones displayed in the window you can scroll back to. | | `name` | _Required_ | String | `PowerShell Core` | Name of the profile. Displays in the dropdown menu.
Additionally, this value will be used as the "title" to pass to the shell on startup. Some shells (like `bash`) may choose to ignore this initial value, while others (`cmd`, `powershell`) may use this value over the lifetime of the application. This "title" behavior can be overriden by using `tabTitle`. | | `padding` | _Required_ | String | `8, 8, 8, 8` | Sets the padding around the text within the window. Can have three different formats: `"#"` sets the same padding for all sides, `"#, #"` sets the same padding for left-right and top-bottom, and `"#, #, #, #"` sets the padding individually for left, top, right, and bottom. | @@ -148,20 +149,20 @@ The most useful URI schemes to remember when customizing background images and i ### Icons Terminal displays icons for each of your profiles which Terminal generates for any built-in shells - PowerShell Core, PowerShell, and any installed Linux/WSL distros. Each profile refers to a stock icon via the `ms-appx` URI Scheme. -> ⚠ Note: Do not rely on the files referenced by the `ms-appx` URI Scheme - they are considered an internal implementation detail and may change name/location or may be omitted in the future. +> ⚠ Note: Do not rely on the files referenced by the `ms-appx` URI Scheme - they are considered an internal implementation detail and may change name/location or may be omitted in the future. You can refer to you own icons if you wish, e.g.: -```json +```json "icon" : "C:\\Users\\richturn\\OneDrive\\WindowsTerminal\\icon-ubuntu-32.png", ``` > 👉 Tip: Icons should be sized to 32x32px in an appropriate raster image format (e.g. .PNG, .GIF, or .ICO) to avoid having to scale your icons during runtime (causing a noticeable delay and loss of quality.) ### Custom Background Images -You can apply a background image to each of your profiles, allowing you to configure/brand/style each of your profiles independently from one another if you wish. +You can apply a background image to each of your profiles, allowing you to configure/brand/style each of your profiles independently from one another if you wish. -To do so, specify your preferred `backgroundImage`, position it using `backgroundImageAlignment`, set its opacity with `backgroundImageOpacity`, and/or specify how your image fill the available space using `backgroundImageStretchMode`. +To do so, specify your preferred `backgroundImage`, position it using `backgroundImageAlignment`, set its opacity with `backgroundImageOpacity`, and/or specify how your image fill the available space using `backgroundImageStretchMode`. For example: ```json diff --git a/src/cascadia/TerminalApp/Profile.cpp b/src/cascadia/TerminalApp/Profile.cpp index fe07983c08b..d293abf5d46 100644 --- a/src/cascadia/TerminalApp/Profile.cpp +++ b/src/cascadia/TerminalApp/Profile.cpp @@ -266,7 +266,9 @@ Json::Value Profile::ToJson() const Json::Value root = GenerateStub(); ///// Profile-specific settings ///// - root[JsonKey(HiddenKey)] = _hidden; + // As of #2795, all profile-specific settings were moved to GenerateStub. If + // any new profiles-specific settings are added, they should probably be + // added here instead of in that method. ///// Core Settings ///// if (_defaultForeground) @@ -448,6 +450,8 @@ Json::Value Profile::GenerateStub() const stub[JsonKey(SourceKey)] = winrt::to_string(_source.value()); } + stub[JsonKey(HiddenKey)] = _hidden; + return stub; } diff --git a/src/cascadia/TerminalApp/defaults.json b/src/cascadia/TerminalApp/defaults.json index a158ad83389..4f5e4020808 100644 --- a/src/cascadia/TerminalApp/defaults.json +++ b/src/cascadia/TerminalApp/defaults.json @@ -15,6 +15,7 @@ "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", "commandline": "powershell.exe", + "hidden": false, "startingDirectory": "%USERPROFILE%", "background": "#012456", "closeOnExit": true, @@ -33,6 +34,7 @@ "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "cmd", "commandline": "cmd.exe", + "hidden": false, "startingDirectory": "%USERPROFILE%", "closeOnExit": true, "colorScheme": "Campbell", diff --git a/src/cascadia/TerminalApp/userDefaults.json b/src/cascadia/TerminalApp/userDefaults.json index 1e4f55ce42d..c96d738884e 100644 --- a/src/cascadia/TerminalApp/userDefaults.json +++ b/src/cascadia/TerminalApp/userDefaults.json @@ -10,13 +10,15 @@ // Make changes here to the powershell.exe profile "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", - "commandline": "powershell.exe" + "commandline": "powershell.exe", + "hidden": false }, { // Make changes here to the cmd.exe profile "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "cmd", - "commandline": "cmd.exe" + "commandline": "cmd.exe", + "hidden": false } ],