mirror of
https://github.com/Andre-Bzk/SunshineDisplaySwitch.git
synced 2026-11-15 09:33:11 +01:00
110 lines
4.1 KiB
Markdown
110 lines
4.1 KiB
Markdown
# SunshineDisplaySwitch
|
|
|
|
[English](#english) | [Deutsch](#deutsch)
|
|
|
|
---
|
|
|
|
## English
|
|
|
|
Solves a problem with game streaming via **Sunshine + Moonlight**: The physical PC monitor is disabled during the stream and reliably reactivated afterwards.
|
|
|
|
### Files
|
|
|
|
| File | Purpose |
|
|
|---|---|
|
|
| `idd_an.bat` | Sunshine Do-Command — enables IDD virtual monitor, disables physical monitor |
|
|
| `idd_aus.bat` | Sunshine Undo-Command — reactivates physical monitor |
|
|
| `register_task.bat` | Run once — registers a logon task as fallback if the PC is shut down during a stream |
|
|
|
|
### Setup
|
|
|
|
#### 1. Configure Sunshine
|
|
|
|
In the Sunshine web UI under **Configuration > General**:
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| Command Preparations — Do | `C:\Projekte\SunshineDisplaySwitch\idd_an.bat` |
|
|
| Command Preparations — Undo | `C:\Projekte\SunshineDisplaySwitch\idd_aus.bat` |
|
|
|
|
#### 2. Register fallback task (once)
|
|
|
|
Run `register_task.bat` as administrator. Registers `DisplaySwitch /internal` as a logon task (`MoonlightTeardown`). This activates if the PC is shut down during a stream and the physical monitor is still disabled on next boot.
|
|
|
|
### How it works
|
|
|
|
```
|
|
Stream starts
|
|
└─> idd_an.bat
|
|
└─> DisplaySwitch.exe /external (IDD active, physical monitor off)
|
|
|
|
Stream ends
|
|
└─> idd_aus.bat
|
|
├─> DisplaySwitch.exe /extend (both displays in topology)
|
|
├─> 4 second wait
|
|
└─> DisplaySwitch.exe /internal (IDD removed, physical monitor stays)
|
|
```
|
|
|
|
#### Why /extend before /internal?
|
|
|
|
After `DisplaySwitch /external`, the physical monitor is removed from the Windows display topology. A direct `DisplaySwitch /internal` cannot bring it back — Windows no longer sees it. `/extend` restores both monitors into the topology, then `/internal` removes the IDD monitor again.
|
|
|
|
### Requirements
|
|
|
|
- Windows 10/11
|
|
- [Sunshine](https://github.com/LizardByte/Sunshine) as streaming server
|
|
- [IDD (Indirect Display Driver)](https://github.com/itsmikethetech/Virtual-Display-Driver) as virtual monitor
|
|
|
|
---
|
|
|
|
## Deutsch
|
|
|
|
Löst ein Problem beim Game-Streaming mit **Sunshine + Moonlight**: Der physische PC-Monitor wird während des Streams deaktiviert und danach zuverlässig wieder aktiviert.
|
|
|
|
### Dateien
|
|
|
|
| Datei | Zweck |
|
|
|---|---|
|
|
| `idd_an.bat` | Sunshine Do-Command — aktiviert virtuellen IDD-Monitor, deaktiviert physischen Monitor |
|
|
| `idd_aus.bat` | Sunshine Undo-Command — reaktiviert physischen Monitor |
|
|
| `register_task.bat` | Einmalig ausführen — registriert Logon-Task als Fallback nach Shutdown während Stream |
|
|
|
|
### Einrichtung
|
|
|
|
#### 1. Sunshine konfigurieren
|
|
|
|
In der Sunshine Web-UI unter **Configuration > General**:
|
|
|
|
| Feld | Wert |
|
|
|---|---|
|
|
| Command Preparations — Do | `C:\Projekte\SunshineDisplaySwitch\idd_an.bat` |
|
|
| Command Preparations — Undo | `C:\Projekte\SunshineDisplaySwitch\idd_aus.bat` |
|
|
|
|
#### 2. Fallback-Task registrieren (einmalig)
|
|
|
|
`register_task.bat` als Administrator ausführen. Registriert `DisplaySwitch /internal` als Logon-Task (`MoonlightTeardown`). Greift, falls der PC während eines Streams heruntergefahren wird und der physische Monitor beim nächsten Start noch deaktiviert ist.
|
|
|
|
### Funktionsweise
|
|
|
|
```
|
|
Stream startet
|
|
└─> idd_an.bat
|
|
└─> DisplaySwitch.exe /external (IDD aktiv, physischer Monitor aus)
|
|
|
|
Stream endet
|
|
└─> idd_aus.bat
|
|
├─> DisplaySwitch.exe /extend (beide Displays in Topologie)
|
|
├─> 4 Sekunden warten
|
|
└─> DisplaySwitch.exe /internal (IDD entfernt, physischer Monitor bleibt)
|
|
```
|
|
|
|
#### Warum /extend vor /internal?
|
|
|
|
Nach `DisplaySwitch /external` wird der physische Monitor aus der Windows Display-Topologie entfernt. Ein direktes `DisplaySwitch /internal` würde ihn nicht zurückholen — er ist für Windows nicht mehr sichtbar. `/extend` bringt beide Monitore zurück in die Topologie, danach entfernt `/internal` den IDD-Monitor wieder.
|
|
|
|
### Voraussetzungen
|
|
|
|
- Windows 10/11
|
|
- [Sunshine](https://github.com/LizardByte/Sunshine) als Streaming-Server
|
|
- [IDD (Indirect Display Driver)](https://github.com/itsmikethetech/Virtual-Display-Driver) als virtueller Monitor
|