2022-04-18 14:53:28 -04:00
Usage
=====
#. See the `setup`_ section for your specific OS.
2022-12-28 16:30:32 -05:00
#. If you did not install the service, then start sunshine with the following command, unless a start command is listed
in the specified package :ref: `installation <about/installation:installation>` instructions.
2022-04-18 14:53:28 -04:00
2022-12-28 16:30:32 -05:00
.. Note :: A service is a process that runs in the background. Running multiple instances of Sunshine is not
advised.
2022-04-18 16:05:17 -04:00
2022-12-28 16:30:32 -05:00
**Basic usage**
.. code-block :: bash
sunshine
**Specify config file**
.. code-block :: bash
sunshine <directory of conf file>/sunshine.conf
.. Note :: You do not need to specify a config file. If no config file is entered the default location will be used.
2022-04-18 14:53:28 -04:00
2022-12-28 16:30:32 -05:00
.. Attention :: The configuration file specified will be created if it doesn't exist.
2022-04-18 14:53:28 -04:00
2023-06-22 20:48:02 -04:00
**Start Sunshine over SSH (Linux/X11)**
.. code-block :: bash
ssh -t <user>@<ip_address> 'startx &; export DISPLAY=:0; sunshine'
.. Note :: You could also utilize the `` ~/.bash_profile `` or `` ~/.bashrc `` files to setup the `` DISPLAY ``
variable.
2022-04-18 14:53:28 -04:00
#. Configure Sunshine in the web ui
2022-10-29 22:14:16 -04:00
2022-04-18 14:53:28 -04:00
The web ui is available on `https://localhost:47990 <https://localhost:47990> `_ by default. You may replace
`localhost` with your internal ip address.
2022-12-28 16:30:32 -05:00
.. Attention :: Ignore any warning given by your browser about "insecure website". This is due to the SSL certificate
being self signed.
2022-04-18 14:53:28 -04:00
2022-12-28 16:30:32 -05:00
.. Caution :: If running for the first time, make sure to note the username and password that you created.
2022-04-18 14:53:28 -04:00
2022-10-29 22:14:16 -04:00
**Add games and applications.**
This can be configured in the web ui.
2022-04-18 14:53:28 -04:00
2022-10-29 22:14:16 -04:00
.. Note :: Additionally, apps can be configured manually. `src_assets/<os>/config/apps.json` is an example of a
list of applications that are started just before running a stream. This is the directory within the GitHub
repo.
2022-04-18 14:53:28 -04:00
#. In Moonlight, you may need to add the PC manually.
#. When Moonlight request you insert the correct pin on sunshine:
- Login to the web ui
2022-06-17 20:05:51 -04:00
- Go to "PIN" in the Navbar
2022-04-18 14:53:28 -04:00
- Type in your PIN and press Enter, you should get a Success Message
- In Moonlight, select one of the Applications listed
Network
-------
2022-08-26 17:05:12 -04:00
The Sunshine user interface will be available on port 47990 by default.
2022-04-18 14:53:28 -04:00
2022-08-26 17:05:12 -04:00
.. Warning :: Exposing ports to the internet can be dangerous. Do this at your own risk.
2022-04-18 14:53:28 -04:00
Arguments
---------
To get a list of available arguments run the following:
.. code-block :: bash
sunshine --help
Setup
-----
Linux
^^^^^
2022-11-18 19:52:58 -04:00
The `deb` , `rpm` , `Flatpak` and `AppImage` packages handle these steps automatically. Third party packages may not.
2022-06-08 23:00:59 -04:00
2022-04-18 14:53:28 -04:00
Sunshine needs access to `uinput` to create mouse and gamepad events.
2022-06-17 20:05:51 -04:00
#. Create `udev` rules.
2023-04-02 19:52:06 +06:00
.. code-block :: bash
2022-06-08 23:00:59 -04:00
2023-05-06 16:51:51 +06:00
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | \
2023-04-02 19:52:06 +06:00
sudo tee /etc/udev/rules.d/85-sunshine.rules
2022-04-18 14:53:28 -04:00
2022-06-17 20:05:51 -04:00
#. Optionally, configure autostart service
2022-06-08 23:00:59 -04:00
2022-10-29 22:14:16 -04:00
- filename: `` ~/.config/systemd/user/sunshine.service ``
- contents:
2022-06-17 20:05:51 -04:00
.. code-block ::
2022-06-08 23:00:59 -04:00
2022-06-17 20:05:51 -04:00
[Unit]
2022-12-28 16:30:32 -05:00
Description=Sunshine self-hosted game stream host for Moonlight.
2023-01-26 16:10:13 +02:00
StartLimitIntervalSec=500
StartLimitBurst=5
2022-04-18 14:53:28 -04:00
2022-06-17 20:05:51 -04:00
[Service]
ExecStart=<see table>
2023-01-26 16:10:13 +02:00
Restart=on-failure
RestartSec=5s
2022-11-18 19:52:58 -04:00
#Flatpak Only
#ExecStop=flatpak kill dev.lizardbyte.sunshine
2022-04-18 14:53:28 -04:00
2022-06-17 20:05:51 -04:00
[Install]
WantedBy=graphical-session.target
2022-06-08 23:00:59 -04:00
2022-06-17 20:05:51 -04:00
.. table ::
:widths: auto
2022-06-15 15:52:38 -04:00
2022-06-17 20:05:51 -04:00
======== ============================================== ===============
package ExecStart Auto Configured
======== ============================================== ===============
2022-06-28 20:39:33 -04:00
aur /usr/bin/sunshine ✔
2022-06-17 20:05:51 -04:00
deb /usr/bin/sunshine ✔
rpm /usr/bin/sunshine ✔
2022-08-24 20:43:46 -04:00
AppImage ~/sunshine.AppImage ✔
2022-11-18 19:52:58 -04:00
Flatpak flatpak run dev.lizardbyte.sunshine ✔
2022-06-17 20:05:51 -04:00
======== ============================================== ===============
2022-06-15 15:52:38 -04:00
2022-10-29 22:14:16 -04:00
**Start once**
2022-06-17 20:05:51 -04:00
.. code-block :: bash
2022-06-08 23:00:59 -04:00
2022-06-17 20:05:51 -04:00
systemctl --user start sunshine
2022-06-08 23:00:59 -04:00
2022-10-29 22:14:16 -04:00
**Start on boot**
2022-06-17 20:05:51 -04:00
.. code-block :: bash
2022-06-08 23:00:59 -04:00
2022-06-17 20:05:51 -04:00
systemctl --user enable sunshine
2022-04-18 14:53:28 -04:00
2022-06-17 20:05:51 -04:00
#. Additional Setup for KMS
.. Note :: `` cap_sys_admin `` may as well be root, except you don't need to be root to run it. It is necessary to
allow Sunshine to use KMS.
2022-06-08 23:00:59 -04:00
2022-10-29 22:14:16 -04:00
**Enable**
2022-06-17 20:05:51 -04:00
.. code-block :: bash
sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))
2022-12-28 16:30:32 -05:00
**Disable (for Xorg/X11)**
2022-06-17 20:05:51 -04:00
.. code-block :: bash
2022-06-08 23:00:59 -04:00
2022-06-17 20:05:51 -04:00
sudo setcap -r $(readlink -f $(which sunshine))
2022-06-08 23:00:59 -04:00
2022-06-17 20:05:51 -04:00
#. Reboot
2022-06-08 23:00:59 -04:00
.. code-block :: bash
2022-04-18 14:53:28 -04:00
2022-06-17 20:05:51 -04:00
sudo reboot now
2022-04-18 14:53:28 -04:00
2022-06-28 19:16:24 -04:00
macOS
2022-04-18 14:53:28 -04:00
^^^^^
Sunshine can only access microphones on macOS due to system limitations. To stream system audio use
`Soundflower <https://github.com/mattingalls/Soundflower> `_ or
2023-02-09 19:41:52 -05:00
`BlackHole <https://github.com/ExistentialAudio/BlackHole> `_ .
2022-04-18 14:53:28 -04:00
.. Note :: Command Keys are not forwarded by Moonlight. Right Option-Key is mapped to CMD-Key.
2022-06-15 15:52:38 -04:00
.. Caution :: Gamepads are not currently supported.
Configure autostart service
2022-10-29 22:14:16 -04:00
**MacPorts**
2022-06-15 15:52:38 -04:00
.. code-block :: bash
sudo port load Sunshine
2022-04-18 14:53:28 -04:00
Windows
^^^^^^^
For gamepad support, install `ViGEmBus <https://github.com/ViGEm/ViGEmBus/releases/latest> `_
2022-12-28 16:30:32 -05:00
Sunshine firewall
**Add rule**
.. code-block :: batch
cd /d "C:\Program Files\Sunshine\scripts"
add-firewall-rule.bat
**Remove rule**
.. code-block :: batch
cd /d "C:\Program Files\Sunshine\scripts"
remove-firewall-rule.bat
Sunshine service
**Enable**
.. code-block :: batch
cd /d "C:\Program Files\Sunshine\scripts"
install-service.bat
**Disable**
.. code-block :: batch
cd /d "C:\Program Files\Sunshine\scripts"
uninstall-service.bat
2022-04-18 14:53:28 -04:00
Shortcuts
---------
2022-10-29 22:14:16 -04:00
All shortcuts start with `` CTRL + ALT + SHIFT `` , just like Moonlight
2022-04-18 14:53:28 -04:00
2022-10-29 22:14:16 -04:00
- `` CTRL + ALT + SHIFT + N `` - Hide/Unhide the cursor (This may be useful for Remote Desktop Mode for Moonlight)
2023-01-10 09:26:42 -05:00
- `` CTRL + ALT + SHIFT + F1/F12 `` - Switch to different monitor for Streaming
2022-04-18 14:53:28 -04:00
Application List
----------------
2022-08-24 20:43:46 -04:00
- Applications should be configured via the web UI.
2022-12-28 16:30:32 -05:00
- A basic understanding of working directories and commands is required.
2022-04-18 14:53:28 -04:00
- You can use Environment variables in place of values
2022-06-08 23:00:59 -04:00
- `` $(HOME) `` will be replaced by the value of `` $HOME ``
2022-08-24 20:43:46 -04:00
- `` $$ `` will be replaced by `` $ `` , e.g. `` $$(HOME) `` will be become `` $(HOME) ``
2022-04-18 14:53:28 -04:00
- `` env `` - Adds or overwrites Environment variables for the commands/applications run by Sunshine
- `` "Variable name":"Variable value" ``
- `` apps `` - The list of applications
2022-12-28 16:30:32 -05:00
- Advanced users may want to edit the application list manually. The format is `` json `` .
2023-03-06 11:10:40 -05:00
- Example `` json `` application:
2022-04-18 14:53:28 -04:00
.. code-block :: json
{
2022-12-28 16:30:32 -05:00
"cmd": "command to open app",
"detached": [
"some-command",
"another-command"
],
"image-path": "/full-path/to/png-image",
"name": "An App",
"output": "/full-path/to/command-log-file",
"prep-cmd": [
{
"do": "some-command",
"undo": "undo-that-command"
}
],
"working-dir": "/full-path/to/working-directory"
2022-04-18 14:53:28 -04:00
}
2022-12-28 16:30:32 -05:00
- `` cmd `` - The main application
- `` detached `` - A list of commands to be run and forgotten about
- If not specified, a process is started that sleeps indefinitely
- `` image-path `` - The full path to the cover art image to use.
2022-04-18 14:53:28 -04:00
- `` name `` - The name of the application/game
- `` output `` - The file where the output of the command is stored
- `` prep-cmd `` - A list of commands to be run before/after the application
2022-10-29 22:14:16 -04:00
- If any of the prep-commands fail, starting the application is aborted
- `` do `` - Run before the application
2022-04-18 14:53:28 -04:00
2022-10-29 22:14:16 -04:00
- If it fails, all `` undo `` commands of the previously succeeded `` do `` commands are run
2022-04-18 14:53:28 -04:00
2022-10-29 22:14:16 -04:00
- `` undo `` - Run after the application has terminated
2022-04-18 14:53:28 -04:00
2022-12-29 10:09:11 -06:00
- Failures of `` undo `` commands are ignored
2022-04-18 14:53:28 -04:00
2022-12-28 16:30:32 -05:00
- `` working-dir `` - The working directory to use. If not specified, Sunshine will use the application directory.
2022-04-18 14:53:28 -04:00
2023-03-06 11:10:40 -05:00
- For more examples see :ref: `app examples <about/app_examples:app examples>` .
2022-04-18 14:53:28 -04:00
Considerations
--------------
- When an application is started, if there is an application already running, it will be terminated.
- When the application has been shutdown, the stream shuts down as well.
2022-10-29 22:14:16 -04:00
- For example, if you attempt to run `` steam `` as a `` cmd `` instead of `` detached `` the stream will immediately fail.
This is due to the method in which the steam process is executed. Other applications may behave similarly.
2023-03-06 11:10:40 -05:00
- The "Desktop" app works the same as any other application except it has no commands. It does not start an application,
instead it simply starts a stream. If you removed it and would like to get it back, just add a new application with
the name "Desktop" and "desktop.png" as the image path.
2022-08-24 20:43:46 -04:00
- For the Linux flatpak you must prepend commands with `` flatpak-spawn --host `` .
2022-12-28 16:30:32 -05:00
2023-01-25 19:48:55 -06:00
HDR Support
-----------
Streaming HDR content is supported for Windows hosts with NVIDIA, AMD, or Intel GPUs that support encoding HEVC Main 10.
You must have an HDR-capable display or EDID emulator dongle connected to your host PC to activate HDR in Windows.
- Ensure you enable the HDR option in your Moonlight client settings, otherwise the stream will be SDR.
- A good HDR experience relies on proper HDR display calibration both in Windows and in game. HDR calibration can differ significantly between client and host displays.
- We recommend calibrating the display by streaming the Windows HDR Calibration app to your client device and saving an HDR calibration profile to use while streaming.
- You may also need to tune the brightness slider or HDR calibration options in game to the different HDR brightness capabilities of your client's display.
- Older games that use NVIDIA-specific NVAPI HDR rather than native Windows 10 OS HDR support may not display in HDR.
- Some GPUs can produce lower image quality or encoding performance when streaming in HDR compared to SDR.
2022-12-28 16:30:32 -05:00
Tutorials
---------
Tutorial videos are available `here <https://www.youtube.com/playlist?list=PLMYr5_xSeuXAbhxYHz86hA1eCDugoxXY0> `_ .
.. admonition :: Community!
Tutorials are community generated. Want to contribute? Reach out to us on our discord server.