{"slug": "show-hn-tray-indicator-for-wsl2-on-off-cpu-and-memory-one-click-shutdown", "title": "Show HN: Tray indicator for WSL2: on/off, CPU and memory, one-click shutdown", "summary": "A developer released a BSD 3-Clause licensed Rust tray tool for Windows 11 that turns WSL2 on and off with one click and displays the virtual machine's CPU and memory usage, avoiding the need to run wsl --shutdown. The tool detects the VM by the presence of the vmmemWSL process and reads CPU and memory via NtQuerySystemInformation(SystemProcessInformation), since vmmemWSL runs as SYSTEM and denies OpenProcess to normal users; a snapshot of roughly 250 processes takes 3.8 ms. The 282 KB executable uses 3.9 MB of private memory after half an hour, one thread while idle, and a 10 to 19 MB working set, with older Windows 10 builds reporting the process as vmmem and requiring a -process flag.", "body_md": "When using my PC for private stuff like gaming or video editing I wanted an direct way (without calling wsl --shutdown) of turning WSL2 off. Created (with a help of Claude, it is 2026...) a small tray tool which barely uses resources and provides also resources usage info.\n\nGrey means the VM is off. Green, orange or red means it is running, coloured by the higher of its CPU and memory share of the machine. Hover for the numbers, menu entry to shut it down.\n\nTwo things that were not obvious: * Presence is the vmmemWSL process existing. WSL reports on distributions, not on the VM. * CPU and memory come from NtQuerySystemInformation(SystemProcessInformation). vmmemWSL runs as SYSTEM, so OpenProcess is denied to a normal user and GetProcessTimes is out. A snapshot of ~250 processes takes 3.8 ms and needs no handle.\n\nRust, windows-sys only. 282 KB exe, 3.9 MB private memory after half an hour, one thread while idle. Working set is 10 to 19 MB, mostly shared DLLs.\n\nTargeted for Windows 11. Older Win10 builds call it vmmem (Use -process flag). Shutdown asks for confirmation. BSD 3-Clause.\n\nComments URL: [https://news.ycombinator.com/item?id=49724577](https://news.ycombinator.com/item?id=49724577)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-tray-indicator-for-wsl2-on-off-cpu-and-memory-one-click-shutdown", "canonical_source": "https://github.com/ideaconnect/wsl-tray", "published_at": "2026-09-16 10:48:15+00:00", "updated_at": "2026-09-16 11:13:51.588604+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["WSL2", "Windows 11", "Rust", "windows-sys", "vmmemWSL", "NtQuerySystemInformation", "Windows 10"], "alternates": {"html": "https://wpnews.pro/news/show-hn-tray-indicator-for-wsl2-on-off-cpu-and-memory-one-click-shutdown", "markdown": "https://wpnews.pro/news/show-hn-tray-indicator-for-wsl2-on-off-cpu-and-memory-one-click-shutdown.md", "text": "https://wpnews.pro/news/show-hn-tray-indicator-for-wsl2-on-off-cpu-and-memory-one-click-shutdown.txt", "jsonld": "https://wpnews.pro/news/show-hn-tray-indicator-for-wsl2-on-off-cpu-and-memory-one-click-shutdown.jsonld"}}