WSLKeeper is a lightweight Windows tray app for keeping selected WSL2 distributions alive.
It provides a compact per-distro toggle UI and uses:
wsl -d <DistroName> -e sleep infinityto prevent idle shutdown for workloads that need long-lived availability (for example SSH/services running inside WSL).
- Tiny tray-first UI (double-click tray icon to reopen)
- Auto-discovery of distros from
wsl -l -v - Per-distro keepalive toggle
- Running-state indicator (
Running/Stopped) - Auto-refresh loop
- Cleanup on app exit
- WSLKeeper reads distro status using
wsl -l -v. - When you enable keepalive for a distro, it launches a detached
wsl.exekeepalive process. - When you disable keepalive, it attempts to stop keepalive for that distro.
- On application exit, keepalive cleanup is executed.
Note: Keepalive intent (toggle state) and runtime state (distro running/stopped) are intentionally handled as separate signals.
- Windows 10/11 with WSL2 installed
- At least one WSL distro
This repository can be built from Linux/WSL using .NET SDK 8.
curl -fsSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh
bash dotnet-install.sh --channel 8.0 --install-dir ~/.dotnet~/.dotnet/dotnet publish \
/home/kyaky/projects/WSLKeeper/src/WSLKeeper/WSLKeeper.csproj \
-c Release \
-r win-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-o /home/kyaky/projects/WSLKeeper/dist/win-x64Build output:
dist/win-x64/WSLKeeper.exe
Launch WSLKeeper.exe on Windows.
- Minimize sends it to tray
- Double-click tray icon to reopen
Validate manually in PowerShell:
wsl -d <DistroName> -e sleep infinityIf this command does not stay active, investigate WSL/distro environment first.
Get-CimInstance Win32_Process |
Where-Object { $_.Name -eq "wsl.exe" -and $_.CommandLine -match "sleep\s+infinity" } |
Select-Object ProcessId, CommandLineGet-CimInstance Win32_Process |
Where-Object { $_.Name -eq "wsl.exe" -and $_.CommandLine -match "sleep\s+infinity" } |
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }Stable for practical local use. Ongoing improvements can focus on stricter per-distro process tracking and additional UI polish.