Why you'd want to do this
You may want to use a dummy adapter to access display modes your monitor can't handle, or disconnect your display while streaming to save power or reduce light pollution. While Sunshine can't directly manage your display settings, you can use Monitor Profile Switcher to control them, with Sunshine triggering the process.
You'll need a display management app
I couldn't find a reliable, user-friendly way to manage displays with batch files or simple scripts, so I recommend checking out Monitor Profile Switcher. If you have a different tool you prefer, you can still follow this guide as long as your app supports command line arguments.
The current build of Monitor 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.
Creating Monitor Profile Switcher profiles
The first thing you'll need to do is setup your display profiles. Monitor Profile Switcher works by saving your current display configuration and assigning it to a profile. To do so, set your desktop to the desired resolution and refresh rate, open the application's tray menu and select "Save Profile" and provide a descriptive name. Repeat this process for any other display profiles you want to create.
Keep in mind that you may need to configure your secondary profile while connected via Sunshine, as it may disconnect your primary display if your configuration requires it.
These configurations are stored as XML files and can be found in your roaming profile data.
C:\Users\ACCOUNT NAME\AppData\Roaming\MonitorSwitcher\Profiles
Alteratively, you can press %appdata%
to directly open your profile's folder. You'll need the full path to the files to configure Sunshine in the next section.
Creating a new application and configuring Sunshine
The idea is to utilize Sunshine's "Do" and "Undo" commands to automatically apply the desired profile when the client connects, and restore the previous profile on disconnection.
The commands have to be tied to an application in Sunshine, so rather than modify the default profile, we'll create a new entry so we have a fallback should any problems arise.
- Open the Sunshine UI and navigate to the "Applications" tab.
- Press "Add New" and give your application a name, like "Second monitor" or something descriptive.
- In the "Command Preparations" section, press the "Add Commands" button.
-
Scroll down to the "Do Command" field and enter the following string, but update the path to your copy of Monitor Profile Switcher and the profile you want to use on connection.
cmd /C D:\Applications\MonitorProfileSwitcher\MonitorSwitcher.exe -load:C:\Users\ACCOUNT NAME\AppData\Roaming\MonitorSwitcher\Profiles\deck.xml
-
In the "Undo command" field, update the value to your default profile. This profile will be applied when the client disconnects.
cmd /C D:\Applications\MonitorProfileSwitcher\MonitorSwitcher.exe -load:C:\Users\ACCOUNT NAME\AppData\Roaming\MonitorSwitcher\Profiles\desktop.xml
- Save the application, apply your changes, and restart Sunshine as prompted.
- When you next connect to Sunshine, you'll see a new application in the list. Launching it should trigger Monitor Profile Switcher and apply the appropriate profile. If it doesn't, check that your paths are correct.
Alternatives
While I've yet to try it, I've heard of people having success in multi-monitor setups with Apollo, a fork of Sunshine configured for and including the SudoVDA virtual display driver.
Troubleshooting
Nothing happens when the application is launched
- Ensure the path to Monitor Profile Switcher is correct.
- Restart Sunshine.
- Ensure that you're selecting the correct application in Moonlight.
- Try checking the "Elevated" option in Sunshine's command options.
The Monitor Profile Switcher command box window appears
This typically happens when the path to Monitor Profile Switcher is correct and launches the application, but it's unable to load the XML file.
- Ensure that the path to your XML file is correct.
- If your configuration files are in folders that contain spaces, you may need to wrap the address in quotation marks.
See also
-
High-quality, low-latency in-home game streaming with Sunshine and Moonlight
Eric Niquette | Niquette.ca
-
How to configure Sunshine to automatically match the client's display resolution
Eric Niquette | Niquette.ca
-
How to reboot, shutdown, or log off from your PC with Moonlight and Sunshine
Eric Niquette | Niquette.ca