diff --git a/pfetch b/pfetch index 2bafa79..825855b 100755 --- a/pfetch +++ b/pfetch @@ -177,17 +177,23 @@ get_os() { command -v guix && distro='Guix System' # Check to see if Linux is running in Windows 10 under - # WSL (Windows subsystem for Linux) and append a string - # accordingly. + # WSL1 (Windows subsystem for Linux [version 1]) and + # append a string accordingly. # # If the kernel version string ends in "-Microsoft", - # we're very likely running under Windows 10 in WSL. - # - # This also acts as a means of allowing the user to - # fake this by changing their kernel version to end in - # "Microsoft". + # we're very likely running under Windows 10 in WSL1. [ "${kernel%%*-Microsoft}" ] || - distro="$distro on Windows 10" + distro="$distro on Windows 10 [WSL1]" + + # Check to see if Linux is running in Windows 10 under + # WSL2 (Windows subsystem for Linux [version 2]) and + # append a string accordingly. + # + # If either of these environment variables are defined + # and non-empty, we are very likely running under + # Windows 10 in WSL2. + [ "$WSL_INTEROP" ] || [ "$WSLENV" ] || [ "$WSL_DISTRO_NAME" ] && + distro="$distro on Windows 10 [WSL1]" ;; Darwin*)