From 44749064b52f98ce14e269572d5131897ee795e2 Mon Sep 17 00:00:00 2001 From: Gabriel Desimone Date: Tue, 5 Oct 2021 14:38:44 -0300 Subject: [PATCH] Add support for Windows 10/11 distinction --- pfetch | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pfetch b/pfetch index e4b39e6..76679a7 100755 --- a/pfetch +++ b/pfetch @@ -279,7 +279,12 @@ get_os() { # If the kernel version string ends in "-Microsoft", # we're very likely running under Windows 10 in WSL1. if [ "$WSLENV" ]; then - distro="${distro}${WSLENV+ on Windows 10 [WSL2]}" + # If we are on WSL2 then we can use interop to + # find out if it is win 10 or win 11 + # FIXME: we are assuming windows is mount on /c/ + # and system have 'tr' + winver=$(/mnt/c/Windows/System32/wbem/wmic.exe os get Caption | grep -i windows | tr -d '\r') + distro="${distro}${WSLENV+ on ${winver} [WSL2]}" # Check to see if Linux is running in Windows 10 under # WSL2 (Windows subsystem for Linux [version 2]) and