terminal/src/cascadia/TerminalSettingsEditor
Schuyler Rosefield 13e9546bab
Persist window layout on window close (#10972)
This commit adds initial support for saving window layout on application
close.

Done:
- Add user setting for if tabs should be maintained.
- Added events to track the number of open windows for the monarch, and
  then save if you are the last window closing.
- Saves layout when the user explicitly hits the "Close Window" button.
- If the user manually closed all of their tabs (through the tab x
  button or through closing all panes on the tab) then remove any saved
  state.
- Saves in the ApplicationState file a list of actions the terminal can
  perform to restore its layout and the window size/position
  information.
- This saves an action to focus the correct pane, but this won't
  actually work without #10978. Note that if you have a pane zoomed, it
  does still zoom the correct pane, but when you unzoom it will have a
  different pane selected.

Todo:
- multiple windows? Right now it can only handle loading/saving one
  window.
   - PR #11083 will save multiple windows.
- This also sometimes runs into the existing bug where multiple tabs
  appear to be focused on opening.

Next Steps:
- The business logic of when the save is triggered can be adjusted as
  necessary.
- Right now I am taking the pragmatic approach and just saving the state
  as an array of objects, but only ever populate it with 1, that way
  saving multiple windows in the future could be added without breaking
  schema compatibility. Selfishly I'm hoping that handling multiple
  windows could be spun off into another pr/feature for now.
- One possible thing that can maybe be done is that the commandline can
  be augmented with a "--saved ##" attribute that would load from the
  nth saved state if it exists. e.g. if there are 3 saved windows, on
  first load it can spawn three wt --saved {0,1,2} that would reopen the
  windows? This way there also exists a way to load a copy of a previous
  window (if it is in the saved state).
- Is the application state something that is planned to be public/user
  editable? In theory the user could since it is just json, but I don't
  know what it buys them over just modifying their settings and
  startupActions.

Validation Steps Performed:
- The happy path: open terminal -> set setting to true -> close terminal
  -> reopen and see tabs. Tested with powershell/cmd/wsl windows.
- That closing all panes/tabs on their own will remove the saved
  session.
- Open multiple windows, close windows and confirm that the last window
  closed saves its state.

The generated file stores a sequence of actions that will be executed to
restore the terminal to its saved form.

References #8324
This is also one of the items on microsoft/terminal#5000
Closes #766
2021-09-08 22:44:53 +00:00
..
Resources/en-US Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
Actions.cpp Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
Actions.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Actions.idl Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
Actions.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
AddProfile.cpp Create a new page for "Add new profile" in the SUI (#9352) 2021-05-05 04:15:25 +00:00
AddProfile.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
AddProfile.idl Create a new page for "Add new profile" in the SUI (#9352) 2021-05-05 04:15:25 +00:00
AddProfile.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Appearances.cpp Add an ENUM setting for disabling rendering "intense" text as bold (#10759) 2021-08-16 13:45:56 +00:00
Appearances.h Add an ENUM setting for disabling rendering "intense" text as bold (#10759) 2021-08-16 13:45:56 +00:00
Appearances.idl Add an ENUM setting for disabling rendering "intense" text as bold (#10759) 2021-08-16 13:45:56 +00:00
Appearances.xaml Disable autocorrect for command, path and find text inputs (#11137) 2021-09-07 10:53:53 -07:00
ColorSchemes.cpp Terminal color picker tweaks (#10219) 2021-06-10 15:49:52 +00:00
ColorSchemes.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
ColorSchemes.idl Redesign color schemes page (#9196) 2021-02-19 18:20:04 +00:00
ColorSchemes.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
CommonResources.xaml Polish code for actions page (#10173) 2021-06-03 22:49:44 +00:00
Converters.cpp [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
Converters.h [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
Converters.idl [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
EnumEntry.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
EnumEntry.idl Enable text search on combo boxes (#9206) 2021-02-19 18:11:07 +00:00
GlobalAppearance.cpp Add Tray Icon settings to the SettingsUI (#11070) 2021-08-31 01:39:03 +00:00
GlobalAppearance.h Add Tray Icon settings to the SettingsUI (#11070) 2021-08-31 01:39:03 +00:00
GlobalAppearance.idl Add Tray Icon settings to the SettingsUI (#11070) 2021-08-31 01:39:03 +00:00
GlobalAppearance.xaml Add Tray Icon settings to the SettingsUI (#11070) 2021-08-31 01:39:03 +00:00
Interaction.cpp Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
Interaction.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Interaction.idl Add missing settings to the settings UI (#8774) 2021-01-14 23:57:59 +00:00
Interaction.xaml Disable autocorrect for command, path and find text inputs (#11137) 2021-09-07 10:53:53 -07:00
KeyChordListener.cpp Introduce vk() and sc() key chord specifiers (#10666) 2021-07-20 22:34:51 +00:00
KeyChordListener.h Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
KeyChordListener.idl Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
KeyChordListener.xaml Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
Launch.cpp Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
Launch.h Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
Launch.idl Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
Launch.xaml Persist window layout on window close (#10972) 2021-09-08 22:44:53 +00:00
MainPage.cpp Allow generated profiles to be deleted (#11007) 2021-08-23 22:00:08 +00:00
MainPage.h Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
MainPage.idl Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
MainPage.xaml Change settings content frame transition to drill in (#10934) 2021-08-12 22:36:10 +00:00
Microsoft.Terminal.Settings.Editor.def Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
Microsoft.Terminal.Settings.Editor.vcxproj Revert "Upgrade to Microsoft.UI.Xaml 2.6.2 (or equivalent) (#10996)" (#11031) 2021-08-24 17:46:12 -05:00
Microsoft.Terminal.Settings.Editor.vcxproj.filters [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
packages.config Revert "Upgrade to Microsoft.UI.Xaml 2.6.2 (or equivalent) (#10996)" (#11031) 2021-08-24 17:46:12 -05:00
pch.cpp Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
pch.h Add a KeyChordListener to the Settings UI (#10652) 2021-07-16 22:11:55 +00:00
PercentageSignConverter.cpp Add percentage sign to opacity slider values (#10369) 2021-06-09 22:45:06 +00:00
PercentageSignConverter.h Add percentage sign to opacity slider values (#10369) 2021-06-09 22:45:06 +00:00
PreviewConnection.cpp Switch Connections to use ValueSets to initialize them (#10184) 2021-07-20 15:02:17 +00:00
PreviewConnection.h Switch Connections to use ValueSets to initialize them (#10184) 2021-07-20 15:02:17 +00:00
Profiles.cpp Allow generated profiles to be deleted (#11007) 2021-08-23 22:00:08 +00:00
Profiles.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Profiles.idl [settings-editor] Switch to function bindings instead of Converter objects (#10846) 2021-08-03 22:25:23 +00:00
Profiles.xaml Disable autocorrect for command, path and find text inputs (#11137) 2021-09-07 10:53:53 -07:00
ReadOnlyActions.cpp Introduce feature flag for editable actions page (#10581) 2021-07-08 20:55:31 +00:00
ReadOnlyActions.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
ReadOnlyActions.idl Introduce feature flag for editable actions page (#10581) 2021-07-08 20:55:31 +00:00
ReadOnlyActions.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Rendering.cpp Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
Rendering.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
Rendering.idl Introduce the Terminal Settings Editor (#8048) 2020-12-11 13:47:10 -08:00
Rendering.xaml Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
SettingContainer.cpp Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
SettingContainer.h Reintroduce the Defaults page and the Reset buttons (#10588) 2021-07-09 22:03:41 +00:00
SettingContainer.idl Introduce setting override tracking and update SettingContainer (#9079) 2021-02-19 23:50:52 +00:00
SettingContainerStyle.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
Utils.cpp Add an Appearances xaml object and AppearanceViewModel to TSE (#10066) 2021-07-09 15:43:58 -05:00
Utils.h Manually dismiss popups when the window moves, or the SUI scrolls (#10922) 2021-08-16 13:41:17 +00:00
ViewModelHelpers.h Enable /Zc:preprocessor (#10593) 2021-07-13 23:00:11 +00:00
ViewModelHelpers.idl.h Introduce setting override tracking and update SettingContainer (#9079) 2021-02-19 23:50:52 +00:00