winfetch icon indicating copy to clipboard operation
winfetch copied to clipboard

Fix Resolution Bug

Open Carterpersall opened this issue 3 years ago • 4 comments

Uses Get-CimInstance fix #76 without creating a massive speed decrease

Closes #76 : ~- 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 #131 w/o PowerShell bottleneck~ ~- 230 ms -> 84 ms~

  • Doesn't work

Possible avenues for speedup:

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration stores multi-display configurations, including resolution, but requires admin to access
    • Maybe check if current instance is elevated
  • HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics has a DPI value but not per-monitor DPI
    • It is used in Windows 8.1 and before as per-display scaling was added in Windows 10
      • Maybe add a Windows version check
  • HKEY_USERS\Whatever-Your-User-GUID-is\Control Panel\Desktop\PerMonitorSettings stores where every monitor's scale is set relative to the recommended value
    • Might work if the script can get the recommended scale of monitors
  • Get-CimInstance -ClassName Win32_VideoController gives resolution, but only for one monitor per video adapter
    • Could use [System.Windows.Forms.SystemInformation]::MonitorCount to check if there's only one monitor connected

Carterpersall avatar Sep 20 '22 19:09 Carterpersall