diff --git a/localization/strings/en-US/Resources.resw b/localization/strings/en-US/Resources.resw
index aa0f5bf72c..4d1201ed42 100644
--- a/localization/strings/en-US/Resources.resw
+++ b/localization/strings/en-US/Resources.resw
@@ -1981,6 +1981,20 @@ You can also access more VS Code Remote options through the command palette with
The number of milliseconds that a VM is idle, before it is shut down.
+
+ Keep WSL VM alive
+
+
+ Keep the WSL virtual machine running instead of shutting it down after it has been idle. When enabled, the VM only stops on "wsl --shutdown" or when the service is stopped.
+ {Locked="wsl --shutdown"} is a command that must not be translated.
+
+
+ Keep WSL VM alive.
+
+
+ Keep the WSL virtual machine running instead of shutting it down after it has been idle. When enabled, the VM only stops on "wsl --shutdown" or when the service is stopped.
+ {Locked="wsl --shutdown"} is a command that must not be translated.
+
Reset timeout
diff --git a/src/windows/wslsettings/ViewModels/Settings/OptionalFeaturesViewModel.cs b/src/windows/wslsettings/ViewModels/Settings/OptionalFeaturesViewModel.cs
index 549f328b75..3c71163834 100644
--- a/src/windows/wslsettings/ViewModels/Settings/OptionalFeaturesViewModel.cs
+++ b/src/windows/wslsettings/ViewModels/Settings/OptionalFeaturesViewModel.cs
@@ -72,6 +72,23 @@ public bool IsOnSparseVHD
set { Set(ref _sparseVHD!, value); }
}
+ public bool IsOnKeepVMAlive
+ {
+ get { return _vMIdleTimeout!.Int32Value < 0; }
+ set
+ {
+ Set(ref _vMIdleTimeout!, value ? -1 : _defaultVMIdleTimeout, nameof(IsOnKeepVMAlive));
+ OnPropertyChanged(nameof(VMIdleTimeout));
+ OnPropertyChanged(nameof(VMIdleTimeoutEnabled));
+ VMIdleTimeout_ResetEnabled = !Equals(_defaultVMIdleTimeout, _vMIdleTimeout!.Int32Value);
+ }
+ }
+
+ public bool VMIdleTimeoutEnabled
+ {
+ get { return _vMIdleTimeout!.Int32Value >= 0; }
+ }
+
public string VMIdleTimeout
{
get
@@ -85,6 +102,8 @@ public string VMIdleTimeout
if (Int32.TryParse(value, out int parsedValue))
{
Set(ref _vMIdleTimeout!, parsedValue);
+ OnPropertyChanged(nameof(IsOnKeepVMAlive));
+ OnPropertyChanged(nameof(VMIdleTimeoutEnabled));
}
else
{
diff --git a/src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml b/src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml
index 26c46e2642..9db5b97c25 100644
--- a/src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml
+++ b/src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml
@@ -41,7 +41,10 @@
-
+
+
+
+