* removed "-l" switch from "choco list" command for Chocolatey 2.0 compatibility
Running `choco list -l` on Chocolatey 2.0.0 produces the following error:
```Invalid argument -l. This argument has been removed from the list command and cannot be used.```
Removing the `-l` switch resolves the error and winfetch works properly again.
* handle "choco list" syntax for chocolatey 1.x and 2.x
* New Method Working
- Replaces the CIM method with one that uses the registry
- Uses `[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Computername).OpenSubKey("HARDWARE\DESCRIPTION\System\CentralProcessor\0")` to get a registry key much faster than `Get-ItemProperty`
- Currently doesn't round the frequency as rounding is slow
* Actually supply it with the computer's name
* Maybe Fix Bug and use smallcase
Attempt to fix bug with duplication of frequency by removing whitespace in split command
* Update winfetch.ps1
---------
Co-authored-by: Rashil Gandhi <rashil2000@gmail.com>
* Implementation Working
- Replicates the functionality of `Get-InstalledModule` and `Get-InstalledScript`
- Has a slight speed increase with Modules, and a slight speed decrease with Scripts
- Largest speed increase comes from the reuse of the output of Get-Package
* More Better
Removed unneeded if-statement and replaced the pipe
* Spelling Fix
* More Faster
- Merged the foreach loops into one, saving a few milliseconds
- Also a extension I have in VSCode cut a bunch of trailing whitespace from $localeLookup
* Maximum speed
- Completely redid the processing of `Get-Package` output
- Instead of using 2 foreach loops, uses a Where statement and counts the returned values
- 3 - 8x faster on the processing step
* Restore formatting
* Fix issue
- Used `-contains`, which doesn't take wildcards
- Replaced with `-like`
* Update winfetch.ps1
---------
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
* New Method Working
Implements a new method of CPU usage retrieval and process counting using .NET
- Uses `System.Diagnostics.PerformanceCounter` to create a CPU time counter
- Gets the value of the CPU time, then gets it again after a delay because the CPU time is the average of two measurements
- 150ms was a good compromise between accuracy and speed as the lower it is set, the less accurate the results are
- The Do-Until loop is to make sure that a proper value is returned, because sometimes a value of 0 or 100 is returned when it fails to retrieve a value
- This does introduce a possible bug where it could get stuck in a loop of someone's computer is pinned at 100%, but it is unlikely this would happen for an extended period of time
- Rounds returned value to 1 decimal place, which is more accurate than the previous implementation
- Gets the process count using `([diagnostics.process]::GetProcesses()).Count`
* Love it when this happens
- Replaces the PerformanceCounter implementation with a significantly faster one
* Update config
Co-authored-by: Rashil Gandhi <rashil2000@gmail.com>
* New Method Working
- Replaces the `Add-Type` implementation with one that uses `System.IO.DriveInfo`
- For once, my new implementation is actually shorter than the previous one
- Significantly faster on both fast and slow systems
* Apply suggestions from code review
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
* Create .gitignore
- Created `.gitignore` with a list of possibly problematic paths
- Created this as I started using VSCode's internal debugger for the project for some troubleshooting which created a `.vscode` folder with some configuration files
* Slim Down .gitignore
- removed irrelevant entries from `.gitignore`
- Kept Desktop.ini and .DS_Store though due to them causing problems quite often
* New Method Working
- Implemented new method to find user's real IPv4 address using a recursive mess of .NET witchcraft that somehow ends up being much faster
- Gets all network adapters using `[System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()`
- Checks if each adapter is online, has a gateway address, and is not a loopback adapter
- Then checks if adapter is a WiFi or Ethernet adapter using `NetworkInterfaceType`
- Then iterates through each Unicast address, and checks if the address is for InterNetwork communication
- Then checks if the $local_ip variable has already been set, and if not, sets it to the IP returned
- This is because under some circumstances, multiple IP's can be returned
- It grabbed the ZeroTier IP address on my PC, which shouldn't occur
- This bug also exists with the previous implementation, and I'm not sure if there is an easy way to fix it without manually filtering out certain adapter names
Speed:
- PowerShell 5:
- 400ms -> 43ms
- 9.3x Faster
- PowerShell 7:
- 459ms -> 56ms
- 8.2x Faster
Possible Extra Checks:
- Check `$ni.GetIPProperties().UnicastAddresses.DhcpLeaseLifetime` for if time is less than 24 hours
* Apply suggestions from code review
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
* Make info_locale blazing fast
- Made info_locale speedy
- Takes the registy entries at HKCU:Control Panel\International to get region code and language code, and passes them into two very large hash tables to get the accompanying region and language values.
- TODO: Make it work when user has more than one language
- Maybe: Find a way to circumvent the very large table
- 3251 ms -> 12.43 ms
- 262x Faster
* Make large table even bigger
- Should fix any issues with missing languages as this was ripped directly from Microsoft's documentation
* Have 3 values per line on table
- Makes it easier to scroll through
* Not break when more than one language is used
- Instead of getting the value of "Languages" of HKCU:Control Panel\International\User Profile, iterates through the multi-key in case multiple languages are configured
* Better format tables
- Added even spacing between the table's values to make much easier to read
* Slight Formatting Change
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
* LInk to Neofetch
* Also remove some redundant words
Hyperfine is mentioned in the linked wiki page, there's no need to mention it here as most people probably don't really care
* Change user, host, and rowname colors to yellow for better visibility
* User@Host color actually changed now
Co-authored-by: bilditup1 <bilditup1@users.noreply.github.com>
* Show missing "winget" identifier.
The choco and scoop packages count both have the package manager identifier written next to it, but winget is missing it. This adds the identifier to keep the output consistent, if users explicitly enable winget in settings.
* "winget" changed to "system"
As the reported number does not correspond to the number of apps installed through winget (but to the number of all installed apps in the system), using "system" seems more appropriate.
* Rewrote disk_info to use Windows API calls instead of WMIC. Renamed old disk_info to disk_info_CIM.
* Moved the C# definition for disk_info to the VARIABLES section.
* Refactored the disk letter comparison section, appears to still not be working entirely.
* Fixed wrong array type for $allDiskLetters.
* Cleaned up the old disk_usage.
* Fixed a missing newline.
* Improve Windows Logo Detection
This also adds support for (the upcoming) Windows 11.
* Remove the "switchlogo" Parameter
This has become useless after our changes to the logo detection logic.
* Add a "logo" Parameter to Set a Specific Version Logo