-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fix Resolution Bug #156
base: master
Are you sure you want to change the base?
Fix Resolution Bug #156
Conversation
- Gets the current resolution scale by getting DisplayTransferCharacteristic from WmiMonitorBasicDisplayParams - Divides by 96 to get the scale from the given PPI - ~2x Slower than the current (but broken) implementation w/o PowerShell bottleneck - 34 ms -> 84 ms - ~2.7x Faster than lptstr#131 w/o PowerShell bottleneck - 230 ms
Even after that it seems to give incorrect answer, it shows me 3200x1800 when I have two monitors at 2560x1440 (enabled - 100% scaling) and 1920x1080 (disabled - 100% scaling). |
This is how I initially had it when I was testing with multiple monitors, I changed it to the broken version later when I had only one so I didn't see this error. |
It seems that the way I'm currently getting the DPI always returns 120 (125%) for some reason. Guess I'm back to square one again sigh |
- Added two methods of getting screen resolution - First one runs if running as admin, and gets the screen information from HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\ - Location contains refresh rate, so I added that in too - Second method uses implementation in lptstr#131 which is about 4x slower for me, but seems to be the only way to get it working that I can find
It should be working now. Added two different implementations depending on if the script is elevated. |
I'm not really a fan of this method. It is extremely unlikely that anyone would run winfetch as admin (most users we get bug reports from don't even have admin rights on their PC), and even if they do, running as admin for just one function does not make much sense. Not to mention that there's essentially no way for users to know that resolution would be reported faster if they run winfetch as admin. In essence the PR brings me back to the problems I had with #131, i.e., increased script complexity and a serious performance regression for the average use case. |
I almost always use PowerShell as admin, but I might be an outlier there.
I agree, but if someone is in an elevated instance already for some other reason, I don't see any reason not to use a faster method exclusive to elevated instances.
We could add a comment into the config file generator that says that a faster method is used in elevated instances
I usually would agree, but the current implementation is broken for everyone who don't have their scaling at 100% (which likely is the majority of users). And the implementation here, while slower, actually works no matter the scaling you have set in your system. |
Since resolution segment is enabled by default, people will not check the config file for it.
It's majority of users who use a non-default scaling, which would actually be a small number. Nevertheless, if we are going to merge the DLLImport code, I'd much rather prefer we do it in #131, because @HO-COOH was the original author for it. As for this PR, we can settle on a middle ground - check for admin and use your method if true, otherwise fallback to what was present originally. |
The bug occurs for everyone who has their scaling set to something other than 100%. And Windows almost always has the default setting higher than 100% (for me it's 200%). This is because Windows tries to set the default scaling to match 720p, and the majority of people using this script will be running 1080p or higher. Thus, for the majority of users, the current implementation does not work correctly.
To prevent this pull request conflicting with the changes in #131, how about #131 gets merged first, then this pull request? |
I'd prefer to keep this as is and see what needs to be done once #131 is merged |
Uses Get-CimInstance fix #76 without creating a massive speed decrease
Closes #76 :
Possible avenues for speedup: