Description
Description of the new feature
Multi local state and settings and multi instance with --localstate
command-line argument
Summary
Introduce a new command-line option -L
or --localstate
to allow users to specify a custom local state directory for Windows Terminal, enabling multiple local states, settings and multi-instance scenarios.
Enhancements:
- Modify command-line argument parsing to support the new local state option
- Update environment variable handling to use the new local state path
Proposed technical implementation details
Reviewer Guide
Introducing the ability to run multiple instances of Windows Terminal with separate settings and state by using the --localstate
command-line argument. Modify parsing to support the new local state option. The changes modify the settings path retrieval logic and window class name generation to incorporate the environment variable, allowing for isolated settings for each instance.
This pull request adds support for a new command-line argument -L
or --localstate
to allow users to specify a custom local state directory for Windows Terminal. The implementation involves modifying command-line argument parsing, updating environment variable handling, and updating file utilities to use the new local state path.
Sequence diagram for handling the new localstate argument
sequenceDiagram
participant User
participant Command Line
participant AppCommandlineArgs
participant WindowEmperor
participant FileUtils
User->>Command Line: wt --localstate <path>
Command Line->>AppCommandlineArgs: Parse arguments
AppCommandlineArgs->>AppCommandlineArgs: Store local state path
AppCommandlineArgs->>WindowEmperor: Launch Terminal
WindowEmperor->>WindowEmperor: Handle Commandline Args
WindowEmperor->>AppCommandlineArgs: Get Local State
WindowEmperor->>FileUtils: Set ENV_WT_BASE_SETTINGS_PATH to local state path
FileUtils->>FileUtils: Create directories at local state path
Updated class diagram for AppCommandlineArgs
classDiagram
class AppCommandlineArgs {
-std::wregex _commandDelimiterRegex
-std::vector<std::wstring> _args
-bool _hasParseError
-bool _shouldExitEarly
-bool _isHandoffListener
-int _loadPersistedLayoutIdx
-std::string _windowTarget
-std::string _localState
+FullResetState()
+GetTargetWindow() string_view
+GetLocalState() string_view
-_getNewTerminalArgs(NewTerminalSubcommand& subcommand) NewTerminalArgs
}
File-Level Changes
Change | Details | Files |
---|---|---|
Introduced a new command-line argument -L or --localstate to allow users to specify a custom local state directory for Windows Terminal. |
|
src/cascadia/WindowsTerminal/WindowEmperor.cpp src/cascadia/TerminalSettingsModel/FileUtils.cpp src/cascadia/TerminalApp/AppCommandlineArgs.cpp src/cascadia/TerminalApp/Remoting.cpp src/cascadia/TerminalApp/AppCommandlineArgs.h src/cascadia/TerminalApp/Remoting.h src/cascadia/CascadiaPackage/Package-Dev.appxmanifest src/cascadia/TerminalApp/Remoting.idl src/cascadia/TerminalApp/Resources/en-US/Resources.resw |
Motivation
I created Windows Terminal Layout Manager application. Which is an advanced yet user-friendly application designed to simplify and streamline the management of your Windows Terminal sessions. Effortlessly save, restore, and dynamically manage multiple terminal layouts and settings, ensuring a smooth and consistent workflow.
WTLayoutManager