Skip to main content
Applications allow you to launch games and programs directly from Moonlight. Each application can have custom commands, working directories, and preparation commands.

Adding Applications

Applications are configured through the Sunshine Web UI or by editing the apps.json file.
  1. Open Sunshine Web UI at https://localhost:47990
  2. Navigate to Applications or Configuration > Applications
  3. Click Add New or similar button
  4. Fill in the application details
  5. Save the application

Via apps.json File

The apps.json file is located in your Sunshine configuration directory. It contains a JSON array of application objects.
Manually editing JSON requires valid syntax. Use the Web UI to avoid errors.

Application Fields

string
required
The display name shown in Moonlight.
string
required
The command or executable to launch.
string
Log file path for application output (useful for debugging).
string
Working directory for the application. Defaults to the executable’s directory if not specified.
array
Commands to run detached (don’t wait for completion). Useful for launchers that spawn child processes.
string
Path or URL to cover image displayed in Moonlight.
boolean
Run with elevated privileges (Windows only, requires Sunshine service).
boolean
Skip global prep commands for this application.
array
Commands to run before/after launching the application.Each entry can have:
  • do - Command to run before launch
  • undo - Command to run after exit
  • elevated - Run with elevated privileges (Windows)

Common Application Examples

Desktop

Steam Big Picture

Steam Game (URI Method)

Steam Game (Direct Executable)

Epic Games Store Game

Preparation Commands

Preparation commands allow you to change system settings before launching an application and restore them afterward.

Change Resolution and Refresh Rate

Sunshine has built-in Windows display configuration. See the Audio/Video Configuration page for Windows-specific settings like dd_resolution_option and dd_refresh_rate_option.

Environment Variables

Sunshine provides environment variables you can use in commands:
number
Resolution width requested by the client
number
Resolution height requested by the client
number
Frame rate requested by the client
string
Whether client requested HDR (“true” or “false”)
number
The unique identifier of the currently running application
string
The name of the currently running application

Cover Images

Cover images are displayed in the Moonlight app selection screen.

Image Format

  • Supported formats: PNG, JPG, JPEG
  • Recommended size: 1280x720 or 1920x1080
  • Aspect ratio: 16:9

Image Location

Relative Paths: Place images in the Sunshine configuration directory:
Absolute Paths:
URLs:

Platform-Specific Considerations

Windows

If Sunshine is installed as a service (default), you can run applications with administrator privileges:
This launches without UAC prompt when using Sunshine service.
Use double backslashes in JSON:

Linux (Flatpak)

Flatpak runs in a sandbox. Commands must be prefixed with flatpak-spawn --host:

macOS

Use open command for applications and URLs:

Complete Example

Here’s a complete application configuration with resolution changes:

Troubleshooting

  • Check output log for errors
  • Verify executable path and working directory
  • Test command manually in terminal
  • Check if elevated privileges are needed
  • Verify prep-cmd syntax
  • Check environment variables are available
  • Enable “Optimize game settings” in Moonlight
  • Test prep-cmd manually
  • Use URI method: steam://rungameid/<appid>
  • Add to detached commands
  • Ensure Steam is running
  • Check game AppID is correct
  • Check image path is correct
  • Verify image format (PNG/JPG)
  • Use absolute path or URL
  • Restart Moonlight client
  • Check command syntax
  • Test commands manually
  • Verify tools are installed
  • Check elevated permissions if needed

Best Practices

Use URI Methods

For Steam/Epic games, use launcher URIs instead of direct executables for better compatibility

Test Commands

Always test prep commands manually before adding to configuration

Add Logging

Use the output field to capture logs for troubleshooting

Environment Variables

Use SUNSHINE_CLIENT_* variables for dynamic resolution changes

Next Steps

General Settings

Configure global prep commands

Audio/Video

Optimize streaming quality for your applications