snipem / moonlight_display_auto_switch

Automatically switches between fake displays and real displays when Moonlight is streaming
7 stars 1 forks source link

Multi-(physical)-monitor support? #2

Open CookieAntonio opened 1 month ago

CookieAntonio commented 1 month ago

Current functionality in my experience: When Sunshine is detected to be streaming, it disables every monitor except the virtual monitor. Upon re-enabling when the Sunshine stream ends, it chooses a monitor (that was not my previous main monitor) to be the new "main" and does not re-enable my other monitors. I have to manually re-enable them and re-configure them through Nvidia control panel.

Am I doing something wrong? Thanks.

CookieAntonio commented 1 month ago

Figured putting the log as well would help.

2024/10/14 12:31:07 monitor_watch v1.2 started 2024/10/14 12:31:08 Fake display LNX0000 is active: false 2024/10/14 12:31:08 Main displays GSM76F9,DELA212,LHC0035 are active: true 2024/10/14 12:31:08 Sunshine is streaming according to log: false 2024/10/14 12:31:18 Fake display LNX0000 is active: false 2024/10/14 12:31:18 Main displays GSM76F9,DELA212,LHC0035 are active: true 2024/10/14 12:31:18 Sunshine is streaming according to log: true 2024/10/14 12:31:18 Sunshine is streaming and main display is active. Deactivate Main Display, activate fake display. 2024/10/14 12:31:34 Fake display LNX0000 is active: true 2024/10/14 12:31:34 Main displays are active: false 2024/10/14 12:31:34 Sunshine is streaming according to log: true 2024/10/14 12:31:44 Fake display LNX0000 is active: true 2024/10/14 12:31:44 Main displays are active: false 2024/10/14 12:31:44 Sunshine is streaming according to log: false 2024/10/14 12:31:44 Sunshine is not streaming and fake display is active. Activate Main Display, deactivate Fake display 2024/10/14 12:31:56 Fake display LNX0000 is active: false 2024/10/14 12:31:56 Main displays ,LHC0035 are active: false 2024/10/14 12:31:56 Sunshine is streaming according to log: false 2024/10/14 12:31:56 Sunshine is not streaming and fake display is active. Activate Main Display, deactivate Fake display

It seems to be only re-activating LHC0035 and disabling the fake display successfully, but it's missing GSM76F9,DELA212. Any help is appreciated.

CookieAntonio commented 1 month ago

Fixed it. First, I hard-coded my monitor's display names. MultiMonitorTool didn't re-activate my other two monitors using the GSM76F9,DELA212 names for some reason. Rather, it preferred .\DISPLAY1, .\DISPLAY2, and .\DISPLAY3. I hard-coded these names into the script. Second, I also revised the script to include a cmd command to restore the previous positions of the monitors. Before, they arbitrarily were placed in a line with no order. MultiMonitorTool has a function where you can press Ctrl+Shift+S to save the current state / resolutions of the monitors, and stores it in the install location for MMT. This configuration can then be loaded in cmd with the command "MultiMonitorTool.exe /LoadConfig "c:\example.cfg"

I know this explanation is a little vague, but I'm leaving it that way because my fix will likely not work for everybody, and I'm sure I'm having this problem because everyone's computer is a little different. I'll leave the issue open with the hopes that at least the monitor configuration via MMT part gets implemented.

Thank you for providing an amazing baseline program. I'll now work on putting this script into my auto-start! :>