dylanaraps / neofetch

🖼️ A command-line system information tool written in bash 3.2+
MIT License
21.88k stars 1.76k forks source link

Fix windows detection to match version #2309

Open MrStanDu33 opened 1 year ago

MrStanDu33 commented 1 year ago

Description

This PR fixes the wrong windows version displayed when host uses Windows 11.

⚠️ Only tested in WSL2 using Debian, not in Windows itself ⚠️

Thanks to @Kwaay for issuing this bug to me and helping me fixing it.

Reason

This bug was caused by neofetch using the command

wmic.exe os get Version

to get the OS version. But this prompt returns

Version
10.0.25330

even if I am using Windows 11. (my build version is 25330, so it is fine).

You can see a comparison here : image

But if we use the command

wmic.exe os get Caption

to get the OS version, we get

Caption
Microsoft Windows 11 Pro Insider Preview

So using this we lose the build number, but we get the correct OS version.

Before (See OS section)

distro_shorthand value result
on image
tiny image
* image

After (See OS section)

distro_shorthand value result
on image
tiny image
* image

Features

Issues

TODO

Unfortunatly I cannot perform tests on other WSLs versions, nor in a Windows 10 machine, but I hope someone can ! 🤞

youquzhiji commented 1 year ago

Tested on Windows 10 WSL2

image

image

hykilpikonna commented 1 year ago

Thank you for your contribution!

This PR is merged into hyfetch since this repo (dylanaraps/neofetch) seems no longer maintained.

HyFetch is a fork of neofetch with LGBTQ pride flags, but the repo also maintains an updated version of the original neofetch, addressing many pull requests that are not merged in the original repo.

Read the "Running Updated Original Neofetch" section for more info!