Skip to content

Added keep alive setting#41109

Open
craigloewen-msft wants to merge 1 commit into
masterfrom
user/crloewen/wsl-keep-alive
Open

Added keep alive setting#41109
craigloewen-msft wants to merge 1 commit into
masterfrom
user/crloewen/wsl-keep-alive

Conversation

@craigloewen-msft

Copy link
Copy Markdown
Member

Summary of the Pull Request

Added a setting to WSL settings to keep the WSL VM alive at all times.

PR Checklist

Very simple change.
image

Detailed Description of the Pull Request / Additional comments

Did this in WSL settings only, no major code changes.

Validation Steps Performed

Validated settings loaded correctly.

Copilot AI review requested due to automatic review settings July 17, 2026 20:00
@craigloewen-msft
craigloewen-msft requested a review from a team as a code owner July 17, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new WSL Settings UI toggle to keep the WSL VM running indefinitely by driving the existing wsl2.vmIdleTimeout setting into a negative value (which the service interprets as “do not idle-terminate”).

Changes:

  • Add a “Keep WSL VM alive” toggle to Optional Features, and disable the VM idle timeout expander when keep-alive is active.
  • Extend the Optional Features view model with keep-alive/enablement properties and related change notifications.
  • Add en-US localized strings (header/description and accessibility text) for the new setting.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml Adds keep-alive toggle and disables the idle-timeout expander based on view model state.
src/windows/wslsettings/ViewModels/Settings/OptionalFeaturesViewModel.cs Adds computed properties for keep-alive and VM idle-timeout enablement, and updates change notification flow.
localization/strings/en-US/Resources.resw Adds localized strings for the new keep-alive setting and toggle accessibility metadata.

<ToggleSwitch x:Uid="Settings_KeepVMAliveToggleSwitch" HorizontalAlignment="Right" MinWidth="0" IsOn="{x:Bind ViewModel.IsOnKeepVMAlive, Mode=TwoWay}"/>
</ctControls:SettingsCard>
<ctControls:SettingsExpander x:Name="VMIdleTimeoutExpander" x:Uid="Settings_VMIdleTimeout" IsEnabled="{x:Bind ViewModel.VMIdleTimeoutEnabled, Mode=OneWay}">
<TextBlock Style="{StaticResource TextBlockSettingStyle}" Text="{x:Bind ViewModel.VMIdleTimeout, Mode=OneWay, Converter={StaticResource MillisecondsStringConverter}}"/>
Comment on lines +87 to +90
public bool VMIdleTimeoutEnabled
{
get { return _vMIdleTimeout!.Int32Value >= 0; }
}
Comment on lines +78 to +84
set
{
Set(ref _vMIdleTimeout!, value ? -1 : _defaultVMIdleTimeout, nameof(IsOnKeepVMAlive));
OnPropertyChanged(nameof(VMIdleTimeout));
OnPropertyChanged(nameof(VMIdleTimeoutEnabled));
VMIdleTimeout_ResetEnabled = !Equals(_defaultVMIdleTimeout, _vMIdleTimeout!.Int32Value);
}
Comment on lines 104 to +106
Set(ref _vMIdleTimeout!, parsedValue);
OnPropertyChanged(nameof(IsOnKeepVMAlive));
OnPropertyChanged(nameof(VMIdleTimeoutEnabled));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants