How to change screen's DPI scaling automatically when switching to multi-monitor setup?

9,780

You can't change DPI scaling automatically because it requires you to logoff and logon.

Here's a good thread on using powershell to set the DPI registry key and toggle back and forth between two DPIs a little quicker. You still have to logoff, and the script automates that.

https://stackoverflow.com/questions/10365394/change-windows-font-size-dpi-in-powershell

If you want to expand on this, here is information about reading monitor information with Powershell: https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/use-powershell-to-discover-multi-monitor-information/

And, here is information about changing the registry key of a specific user. This will be needed because if you run your script while you are not logged on, or during startup your registry hive will not be loaded. https://www.pdq.com/blog/modifying-the-registry-of-another-user/

Combine it all together with some ingenuity and you could schedule this script to run on logoff and on computer startup. The tricky part is that you will always have to be doing a new logon to get the new settings to take effect and to me, that is the biggest drawback about this.

Now, a better solution might be to change the actual display resolution which can be done without logging off: https://blogs.technet.microsoft.com/heyscriptingguy/2010/07/07/hey-scripting-guy-how-can-i-change-my-desktop-monitor-resolution-via-windows-powershell/

A lot of programs do not function properly with a non-standard DPI, and so if you ask me, changing the display resolution is a better solution.

So there you have it. All the resources to create your new script to automate this. Now you can see if you can get anybody over at http://stackoverflow.com to help you with it. :)

Share:
9,780

Related videos on Youtube

gronostaj
Author by

gronostaj

Updated on September 18, 2022

Comments

  • gronostaj
    gronostaj over 1 year

    I have a 14" 1920×1080 laptop and a 24" 1920×1200 screen. The pixel density difference is huge.

    When I'm using the large screen as a main one and laptop as an additional screen, I'd like to have the smaller one set to 150% scaling so that I can use it comfortably. But when I'm away from my desk and the external screen is disconnected, I'd like the laptop to automatically switch to 100% scaling to maximize desktop area.

    How can I make Windows switch DPI scaling automatically when external screens are connected or disconnected?

    I'm okay with using 3rd party software if it's necessary, but I'd rather stick to built-in features of Windows.

    I'm using Windows 10 Pro Version 1703.

    • ben_re
      ben_re almost 7 years
      I don't think there is any Windows feature to do what you want. How badly do you want it? You might be able to do something with powershell, but it will likely be monstrously over complicated.
    • gronostaj
      gronostaj almost 7 years
      @lifesaspanner Well, I've priced my need for it at 50 reputation points paid with a bounty ;) It could be useful for me, but I don't have a burning need for it.
    • jcam3
      jcam3 almost 7 years
      @gronostaj I'm currently working on a similar project using batch files to call powershell scripts, but mine concerns monitor brightness. I should have it nailed down by early next week, so if there isn't an answer at that point I will at least share my research and process with you. This should absolutely be able to be done through powershell, but it will be a pain in your behind.
    • gronostaj
      gronostaj almost 7 years
      @jcam3 That may be interesting to look at! If that's of any use to you, ScreenBright can control screen brightness of external displays via DDC/CI and has command-line interface. I'm using it with SE-TrayMenu to control brightness from the notification area.
    • jcam3
      jcam3 almost 7 years
      @gronostaj I'll have to take a closer look at that application, looks interesting. What I'm trying to do is basically a 3-5 second brightness reduction looped every 20 minutes or so. The idea is to have an automatic non-intrusive reminder to take a screen break now and then for eye strain relief. Has potential for a pomodoro-style application too, but have to get it working first.
    • gronostaj
      gronostaj almost 7 years
      Downvoter, please explain what's wrong with this question.
  • Daniel B
    Daniel B almost 7 years
    “You can't change DPI scaling automatically because it requires you to logoff and logon.” That’s no longer true. It only applies to legacy scaling. Windows 10 can change scaling on the fly.
  • Appleoddity
    Appleoddity almost 7 years
    Sorry but you are wrong about this. Windows always adjusts the DPI but then indicates you have to sign-out to complete the change. Try it, you'll see. Just confirmed it myself on Windows 10.
  • Daniel B
    Daniel B almost 7 years
    More specifically, the message reads: “Some apps won’t respond to scaling until you sign out.” – And that’s how it is. It scales instantly. Most programs respond correctly. Few do not.
  • Appleoddity
    Appleoddity almost 7 years
    Fair enough. But, I have been unable to locate an API to modify DPI and I am only assuming it is because of the requirement to logoff and logon (even if only for certain apps) and the incompatibility that some programs do exhibit.
  • gronostaj
    gronostaj almost 7 years
    Logging off is not an option for me, it would interrupt my workflow. I want DPI to change seamlessly when screen setup changes.
  • Simon
    Simon almost 6 years
    I've just installed a 4k display (as a 2nd monitor to an old laptop that I didn't even think was able to drive it) for the first time. Windows 10 will let me update the DPI setting for this monitor and it updates right away. But for the laptop screen it gives me a warning message. Still puzzled.