Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Windows Logo Detection #88

Merged
merged 3 commits into from
Jul 2, 2021
Merged

Improve Windows Logo Detection #88

merged 3 commits into from
Jul 2, 2021

Conversation

lzlrd
Copy link
Contributor

@lzlrd lzlrd commented Jun 20, 2021

This also adds support for (the upcoming) Windows 11.

@lzlrd lzlrd force-pushed the master branch 2 times, most recently from f4e2050 to c6f6705 Compare June 20, 2021 22:58
@lzlrd
Copy link
Contributor Author

lzlrd commented Jun 20, 2021

The force-pushes were to add Windows 8/8.1 support, alongside fixing the edgecase of a possible "Windows 110" being recognised as "Windows 11".

@lzlrd
Copy link
Contributor Author

lzlrd commented Jun 20, 2021

Here's an example of how the Windows 11 ASCII art looks:

image

@rashil2000
Copy link
Member

I was starting to think our logo detection logic might be getting a little stale after the recent leaks xD

The switchlogo parameter is now useless, so it needs to be removed completely (it's still present in your PR).

Also, a more robust way of detecting Windows major version names would be through build numbers - it allows more flexibility and less hard-coded comparisons. So I don't think we should be comparing strings for that. What do you think @jcwillox?

I was about to add Windows 11 logo myself, but it is still not confirmed what build numbers they'll start with (rumor is 22000).

@lzlrd
Copy link
Contributor Author

lzlrd commented Jun 21, 2021

I was starting to think our logo detection logic might be getting a little stale after the recent leaks xD

The switchlogo parameter is now useless, so it needs to be removed completely (it's still present in your PR).

Also, a more robust way of detecting Windows major version names would be through build numbers - it allows more flexibility and less hard-coded comparisons. So I don't think we should be comparing strings for that. What do you think @jcwillox?

I was about to add Windows 11 logo myself, but it is still not confirmed what build numbers they'll start with (rumor is 22000).

I've removed the switchlogo parameter in a follow-up commit (as shown above).

With regards to using build numbers, we'd then have to keep track (via an array or dictionary) the list of minimum build numbers for each version of Windows (therefore still hard-coding) as opposed to just matching the version string. It isn't much different functionally, but is cleaner to utilise version string matching. At the end of the day, there are less Windows versions than Winodws builds.

An alternative may be to use the kernel version, however the problem with that is that both the "leaked" Windows 11 build and the first set of Windows 10 builds all used kernel versions of their predecessor and, as such, would be detected incorrectly.

@jcwillox
Copy link
Member

Haha, might be a little early to be adding Windows 11 support but I'm all for it XD.

I have to agree while build number would seem to be the better method of detection, but matching the version string is probably going to be the easiest and most reliable. Plus any performance difference shouldn't be noticeable.

As for the -switchlogo parameter, we should create a new -logo parameter to set the logo e.g. -logo "Windows 11".

@lzlrd lzlrd force-pushed the master branch 2 times, most recently from 64098f1 to 70c5c68 Compare June 22, 2021 08:53
lzlrd added 2 commits June 22, 2021 10:02
This also adds support for (the upcoming) Windows 11.
This has become useless after our changes to the logo detection logic.
@lzlrd
Copy link
Contributor Author

lzlrd commented Jun 22, 2021

Haha, might be a little early to be adding Windows 11 support but I'm all for it XD.

I have to agree while build number would seem to be the better method of detection, but matching the version string is probably going to be the easiest and most reliable. Plus any performance difference shouldn't be noticeable.

As for the -switchlogo parameter, we should create a new -logo parameter to set the logo e.g. -logo "Windows 11".

I've added the logo paramater you requested and corrected the previous commits so that they aren't broken if ever ungrouped (hence the force-pushes). Hopefully this meets your criteria.

Copy link
Member

@jcwillox jcwillox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me

winfetch.ps1 Outdated Show resolved Hide resolved
winfetch.ps1 Show resolved Hide resolved
winfetch.ps1 Show resolved Hide resolved
@rashil2000
Copy link
Member

Great! Thanks for the contribution @lazerl0rd !

@rashil2000 rashil2000 merged commit 8f41cf6 into lptstr:master Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants