Created
November 6, 2024 20:10
-
-
Save victor141516/57af0d61b58806e8253a07d49dc74c9e to your computer and use it in GitHub Desktop.
sunshine display screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[Parameter(Mandatory=$true)][string]$status | |
) | |
$isOnStart=$true | |
if ($status -eq "start") { | |
$isOnStart=$true | |
} elseif ($status -eq "end") { | |
$isOnStart=$false | |
} else { | |
Write-Output "Usage: zzz-change-display.ps1 -status start|end" | |
exit | |
} | |
cd C:\IddSampleDriver | |
.\MultiMonitorTool.exe /scomma .\displays.csv | |
$dummyMonitor = Import-Csv -Path .\displays.csv | ? "Device ID" -like *iddsampledriver* | select -ExpandProperty Name | |
$realMonitors = (Import-Csv -Path .\displays.csv | ? "Device ID" -notlike *iddsampledriver* | select -ExpandProperty Name) -join " " | |
if ($isOnStart) { | |
.\MultiMonitorTool.exe /enable $dummyMonitor | |
Start-Sleep -Seconds 3 | |
.\MultiMonitorTool.exe /SetMonitors "Name=$dummyMonitor BitsPerPixel=32 Width=$env:SUNSHINE_CLIENT_WIDTH Height=$env:SUNSHINE_CLIENT_HEIGHT DisplayFlags=0 DisplayFrequency=$env:SUNSHINE_CLIENT_FPS DisplayOrientation=0 PositionX=0 PositionY=0" | |
Start-Sleep -Seconds 3 | |
.\MultiMonitorTool.exe /SetPrimary $dummyMonitor | |
Start-Sleep -Seconds 3 | |
Start-Process -FilePath .\MultiMonitorTool.exe -ArgumentList "/disable $realMonitors" | |
Start-Sleep -Seconds 1 | |
Start-Process -FilePath .\MultiMonitorTool.exe -ArgumentList "/disable $realMonitors" | |
} else { | |
.\MultiMonitorTool.exe /disable $dummyMonitor | |
Start-Sleep -Seconds 3 | |
Start-Process -FilePath .\MultiMonitorTool.exe -ArgumentList "/enable $realMonitors" | |
Start-Sleep -Seconds 3 | |
.\MultiMonitorTool.exe /LoadConfig zzz-normal.cfg | |
Start-Sleep -Seconds 1 | |
.\MultiMonitorTool.exe /LoadConfig zzz-normal.cfg | |
Start-Sleep -Seconds 3 | |
.\MultiMonitorTool.exe /SetPrimary \\.\DISPLAY2 | |
Start-Sleep -Seconds 1 | |
.\MultiMonitorTool.exe /SetPrimary \\.\DISPLAY2 | |
} | |
# PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\IddSampleDriver\zzz-change-display.ps1' -status start|end" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment