Eric Niquette

The problem

You’ve got an ultrawide monitor on your desktop, but your Steam Deck only supports 1280x800 resolution. Streaming from your PC results in a desktop that’s almost unusable, requiring manual resolution adjustments each time. Instead of constantly tweaking Windows display settings, we can automate this process. By using a simple display management tool and a couple of commands, you can configure Sunshine to automatically match the client's display resolution when you connect and revert to your original resolution when you disconnect.

How it works

When Sunshine and Moonlight negotiate a connection, Sunshine will gather data from the client, including the display's height, width, and its framerate. This information is made available as variables, which we can use to create a command that will adjust the host's display resolution to match the client's.

What you'll need

To get this working, you'll need a small, open-source application called QRes. I'll level with you — QRes is ancient and hasn't been updated in over ten years at this point. However, it still works perfectly in Windows 11. It's lightweight, doesn't require installation, and doesn't run in the background. It launches on command, does its thing, then terminates itself.

QRes works with command argument so running the following will set your display to 1920x1080 at 120hz, where the values of X represents the horizontal width, Y the height, and R the refresh rate.

qres.exe /x 1920 /y 1080 /r 120

With that said, download QRes, store it somewhere accessible, and copy the full path to the executable — we'll need it in a minute.

Creating a new application and configuring Sunshine

To execute our commands, we're going to add a new application in Sunshine instead of modifying the default profile, so we have a fallback should the automatic match fail. This application will trigger the resolution matching when launched.

  1. Open the Sunshine UI and navigate to the "Applications" tab.
  2. Press "Add New" and give your application a name.
  3. In the "Command Preparations" section, press the "Add Commands" button.
  4. Scroll down to the "Do Command" field and enter the following string, updating only the path to your copy of QRes:
    cmd /C D:\Applications\QRes\QRes.exe /x %SUNSHINE_CLIENT_WIDTH% /y %SUNSHINE_CLIENT_HEIGHT% /r %SUNSHINE_CLIENT_FPS%

    Note that the variable %SUNSHINE_CLIENT_FPS% is based on the Moonlight stream's framerate, and not the client display's refresh rate. You can omit the /r switch entirely if you don't think you'll need it or prefer having the host run at its full framerate.

  5. In the "Undo command" field, enter the following but change the X, Y, and R values to your monitor's default resolution and refresh rate, which will be applied when the client terminates the session.
    cmd /C D:\Applications\QRes\QRes.exe /x 3840 /y 2160 /r 120
  6. Save the application, apply your changes, and restart Sunshine as prompted.
  7. When you next connect to Sunshine, you'll see a new application in the list. Launching it will trigger QRes and perform the resolution matching.

Limitations and other things you should keep in mind

While it works well, this isn't a perfect solution. There's a couple of small caveats and limitations to this technique that you should keep in mind:

  • Devices with non-standard resolutions, like phones, will likely result in a connection failure as the display will fail to match. For that reason, I don't recommend you add the commands to the default Desktop profile so you have a fallback option. Alternatively, you can configure Moonlight to use a standard resolution for the client rather than its native display's resolution.
  • To restore the default resolution, you'll need to fully terminate the session in Moonlight, not just disconnect. Some Moonlight clients have an auto-terminate option, which can help with that.
  • QRes does not support HDR, so you're own your own for that one. Sunshine does have a variable for it, though, and if you have the Xbox Game Bar installed you can press Win + Alt + B to toggle the feature.

Alternatives

Resolution Automation

Specifically built for Sunshine and Moonlight, Resolution Automation, as its name implies, automatically changes the host's resolution based on the client's configuration.

The tool features a one-click installation script but does require a small Windows configuration and a full installation of Sunshine; the portable version is not supported.

In my experience, Resolution Automation tends to be hit and miss and has broken a few times. To its credit, I hop between different devices and configurations fairly often, which may be causing issues. Give it a shot, though! It's an elegant solution when it works.

Monitor Profile Switcher

If you use multiple monitors or often swap your display configuration, Monitor Profile Switcher is a handy tool that can toggle user created layouts, resolutions, and refresh rates using shortcut keys or via the command line. For example, I use it to toggle between my desktop's multi-monitor display mode, living room TV gaming mode, movie mode, and a few other profiles with the press of shortcut keys like Ctrl + Alt + Shift + 1.

It can also be used with command-line arguments that can be utilized in Sunshine's commands, so you could easily toggle off your secondary monitors, change resolution, and change the refresh rate on connection and restore it on termination. I've written an article on configuring Sunshine to automatically switch displays if that's something you're interested in doing.

The current build of Monior Profile Switcher does not correctly apply refresh rates on Windows 11. Until implemented to the main branch, you can download a user build from this forum post. I've archived the file in case the thread goes missing so get in touch if you need it.