neofetch: Fix windows detection to match version
This commit is contained in:
parent
ccd5d9f526
commit
6778fd42a5
1 changed files with 25 additions and 5 deletions
30
neofetch
30
neofetch
|
@ -1101,14 +1101,34 @@ get_distro() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Gets the windows tag caption (ie `Microsoft Windows 11 Pro Insider Preview`)
|
||||||
|
#
|
||||||
|
# Then removes the `Microsoft` and `Windows` part and gets the current
|
||||||
|
# version of Windows (old code reported Windows 10 even if host runs Windows 11).
|
||||||
|
#
|
||||||
|
# Finally, we decline it in three versions :
|
||||||
|
#
|
||||||
|
# - The `on` version (ie `[Windows 11.0.25330]`)
|
||||||
|
# - The `tiny` version (ie `Windows 11`)
|
||||||
|
# - The `any` version (ie `on Windows 11 Pro Insider Preview`)
|
||||||
if [[ $(< /proc/version) == *Microsoft* || $kernel_version == *Microsoft* ]]; then
|
if [[ $(< /proc/version) == *Microsoft* || $kernel_version == *Microsoft* ]]; then
|
||||||
windows_version=$(wmic.exe os get Version)
|
|
||||||
windows_version=$(trim "${windows_version/Version}")
|
windows_version_verbose=$(wmic.exe os get Caption)
|
||||||
|
windows_version_verbose=$(trim "${windows_version_verbose/Caption}")
|
||||||
|
windows_version_verbose=$(trim "${windows_version_verbose/Microsoft}")
|
||||||
|
windows_version_verbose=$(trim "${windows_version_verbose/Windows}")
|
||||||
|
|
||||||
|
windows_version_current=${windows_version_verbose//[^[:digit:]]/}
|
||||||
|
|
||||||
|
windows_version_number_long=$(wmic.exe os get Version)
|
||||||
|
windows_version_number_long=$(trim "${windows_version_number_long/Version}")
|
||||||
|
windows_version_number_long=$(trim "${windows_version_number_long}")
|
||||||
|
windows_version_number_long="${windows_version_current}${windows_version_number_long:2}"
|
||||||
|
|
||||||
case $distro_shorthand in
|
case $distro_shorthand in
|
||||||
on) distro+=" [Windows $windows_version]" ;;
|
on) distro+=" [Windows $windows_version_number_long]" ;;
|
||||||
tiny) distro="Windows ${windows_version::2}" ;;
|
tiny) distro=" Windows $windows_version_current" ;;
|
||||||
*) distro+=" on Windows $windows_version" ;;
|
*) distro+=" on Windows $windows_version_verbose" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
elif [[ $(< /proc/version) == *chrome-bot* || -f /dev/cros_ec ]]; then
|
elif [[ $(< /proc/version) == *chrome-bot* || -f /dev/cros_ec ]]; then
|
||||||
|
|
Loading…
Reference in a new issue