cd C:\IddSampleDriver
MultiMonitorTool.exe /disable \\.\DISPLAY9
Configure sunshine to run scripts when stream is launched and finished, inside Configuration -> General
now every time you launch a game in stream through moonlight + sunshine, the script Steamdeck-on.cmd, will turn off the “real” monitors you have, turn on a virtual monitor with the steam deck resolution, put this virtual monitor as primary and the game will launch and stream from this virtual monitor.
When you finish the game session, the script Steamdeck-off.cmd will disable the virtual monitor (you can add commands to turn on real monitors)
Seems like a good idea, but why didn't the off script reset the SetPrimary monitor? And does the "turn off" command just temporarily turn the screens off, so any action on the desktop will turn the screens back on?
Edit: Also, the cd command seems a bit strange. I haven't written a batch file in a while, but I think there's a way to set the path as a variable and then call the executables directly. Probably doesn't matter, but changing directories in a .bat file just feels wrong for some reason, y'know?
Regardless, thanks for posting. This is a great idea, regardless of the specific implementation details.
So after sitting down and setting it up, I found that on my setup the script above didn't work for my machine. I had to set up my own scripts that specified the path of the executable, and then I used a command that toggles the monitor instead, it worked much better that way.
But scripting aside, now that it's working, it is beautiful! Set it up for my living room TV to be a 4k 120hz virtual monitor.