![]() |
Sunshine master
Self-hosted game stream host for Moonlight.
|
Since not all applications behave the same, we decided to create some examples to help you get started adding games and applications to Sunshine.
Output
field).Field | Value |
---|---|
Application Name | Desktop
|
Image | desktop.png
|
Field | Value |
---|---|
Application Name | Steam Big Picture
|
Detached Commands | setsid steam steam://open/bigpicture
|
Image | steam.png
|
Field | Value |
---|---|
Application Name | Steam Big Picture
|
Detached Commands | open steam steam://open/bigpicture
|
Image | steam.png
|
Field | Value |
---|---|
Application Name | Steam Big Picture
|
Detached Commands | steam://open/bigpicture
|
Image | steam.png
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Commands | com.epicgames.launcher://apps/d759128018124dcabb1fbee9bb28e178%3A20729b9176c241f0b617c5723e70ec2d%3AOvenbird?action=launch&silent=true
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | MarsEpic.exe
|
Working Directory | "C:\Program Files\Epic Games\SurvivingMars"
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | "C:\Program Files\Epic Games\SurvivingMars\MarsEpic.exe"
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Detached Commands | setsid steam steam://rungameid/464920
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Detached Commands | open steam://rungameid/464920
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Detached Commands | steam://rungameid/464920
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | MarsSteam
|
Working Directory | ~/.steam/steam/SteamApps/common/Survivng Mars
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | MarsSteam
|
Working Directory | ~/.steam/steam/SteamApps/common/Survivng Mars
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | MarsSteam.exe
|
Working Directory | "C:\Program Files (x86)\Steam\steamapps\common\Surviving Mars"
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | ~/.steam/steam/SteamApps/common/Survivng Mars/MarsSteam
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | ~/.steam/steam/SteamApps/common/Survivng Mars/MarsSteam
|
Field | Value |
---|---|
Application Name | Surviving Mars
|
Command | "C:\Program Files (x86)\Steam\steamapps\common\Surviving Mars\MarsSteam.exe"
|
Prep Step | Command |
---|---|
Do | sh -c "xrandr --output HDMI-1 --mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT} --rate ${SUNSHINE_CLIENT_FPS}"
|
Undo | xrandr --output HDMI-1 --mode 3840x2160 --rate 120
|
The above only works if the xrandr mode already exists. You will need to create new modes to stream to macOS and iOS devices, since they use non-standard resolutions.
You can update the Do
command to this:
The set-custom-res.sh
will have this content:
Prep Step | Command |
---|---|
Do | sh -c "wlr-xrandr --output HDMI-1 --mode \"${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}Hz\""
|
Undo | wlr-xrandr --output HDMI-1 --mode 3840x2160@120Hz
|
wlr-xrandr
only works with wlroots-based compositors.Prep Step | Command |
---|---|
Do | sh -c "xrandr --output HDMI-1 --mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT} --rate ${SUNSHINE_CLIENT_FPS}"
|
Undo | xrandr --output HDMI-1 --mode 3840x2160 --rate 120
|
The commands above are valid for an X11 session but won't work for Wayland. In that case xrandr
must be replaced by gnome-randr.py. This script is intended as a drop-in replacement with the same syntax. (It can be saved in /usr/local/bin
and needs to be made executable.)
Prep Step | Command |
---|---|
Do | sh -c "kscreen-doctor output.HDMI-A-1.mode.${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}"
|
Undo | kscreen-doctor output.HDMI-A-1.mode.3840x2160@120
|
HDMI-A-0
, but on Wayland, it may be called HDMI-A-1
. Replace HDMI-A-1
with the display name of the monitor you would like to use for Moonlight. You can list the monitors available to you with:
These will also give you the supported display properties for each monitor. You can select them either by hard-coding their corresponding number (e.g. kscreen-doctor output.HDMI-A1.mode.0
) or using the above do
command to fetch the resolution requested by your Moonlight client (which has a chance of not being supported by your monitor).
Prep Step | Command |
---|---|
Do | sh -c "nvidia-settings -a CurrentMetaMode=\"HDMI-1: nvidia-auto-select { ViewPortIn=${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}, ViewPortOut=${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}+0+0 }\""
|
Undo | nvidia-settings -a CurrentMetaMode=\"HDMI-1: nvidia-auto-select { ViewPortIn=3840x2160, ViewPortOut=3840x2160+0+0 }"
|
displayplacer
tool to change the resolution. This tool can be installed following instructions in their GitHub repository.
Prep Step | Command |
---|---|
Do | sh -c "displayplacer \"id:<screenId> res:${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT} hz:${SUNSHINE_CLIENT_FPS} scaling:on origin:(0,0) degree:0\""
|
Undo | displayplacer "id:<screenId> res:3840x2160 hz:120 scaling:on origin:(0,0) degree:0"
|
Sunshine has built-in support for changing the resolution and refresh rate on Windows. If you prefer to use a third-party tool, you can use QRes as an example.
Prep Step | Command |
---|---|
Do | cmd /C "FullPath\qres.exe /x:%SUNSHINE_CLIENT_WIDTH% /y:%SUNSHINE_CLIENT_HEIGHT% /r:%SUNSHINE_CLIENT_FPS%"
|
Undo | FullPath\qres.exe /x:3840 /y:2160 /r:120
|
flatpak-spawn --host
.Elevating Commands (Windows)
If you've installed Sunshine as a service (default), you can specify if a command should be elevated with administrative privileges. Simply enable the elevated option in the WEB UI, or add it to the JSON configuration. This is an option for both prep-cmd and regular commands and will launch the process with the current user without a UAC prompt.
Example