Closed sergeivich closed 1 month ago
Setting the virtual display to primary before the stream starts is a must for sunshine to use the virtual screen for streaming.
You can set the primary display back after the stream starts manually or using MultiMonitorTool to automate the process.
https://www.nirsoft.net/utils/multi_monitor_tool.html
Add to the game command like this with the proper display name to your "Desktop" app:
You can obtain the display name by running the MultiMonitorTool directly from Explorer.
Thank you for the tip. I ran the command in sunshine directly, but it just mirrored the displays. I had to set a delay. I tried some other tools with sunshine directly but it only mirrors displays if there is no delay. For anyone else reading this, I made an autohotkey script so the primary display reverts to internal after launch.
Sure! Here's a script to execute the command D:\Tools\MultiMonitorTool.exe /SetPrimary \\.\DISPLAY1
when a second display is detected:
#Persistent
; Function to check if a second display is connected
CheckSecondDisplay() {
SysGet, MonitorCount, MonitorCount
return (MonitorCount > 1) ; Return true if more than one monitor is detected
}
; Variable to track the state of the second display
secondDisplayConnected := false
; Loop indefinitely
Loop {
; Check for second display
if CheckSecondDisplay() {
if (!secondDisplayConnected) {
; Second display is now connected
secondDisplayConnected := true
; Wait for an additional 10 seconds
Sleep, 10000
; Execute the command to set primary display
Run, D:\Tools\MultiMonitorTool.exe /SetPrimary \\.\DISPLAY1
}
} else {
; Reset the state if the second display is not detected
secondDisplayConnected := false
}
; Wait for 500 milliseconds before checking again
Sleep, 500
}
Save this script with a .ahk
extension and run it using AutoHotkey. The script will wait until a second display is detected, wait for 10 seconds, execute the command to set the primary display to \\.\DISPLAY1
, and then continue monitoring for changes.
You need to put the command at GAME COMMAND
, it's not the same place you put widecar commands, nor Detatched commands
.
When Sunshine executes the game command, it's already streaming with the correct display.
Edit: After some testing it does capture the internal display sometimes. Looking for a better solution...
Add the line to Detatched commands
, remove the game command
You can change the timeout accordingly.
This works great, tested back to back 10 times just using extended desktop. 8/10 times it worked, 2/10 mirrored internal monitor. thank you
Hi, is there any way to force sunshine/parsec/widecar to maintain display 1 as main display persistent? Display 2 always becomes main display when connecting.