Skip to content

implements apple-like sidecar in KDE using sunshine with XDG portal support.

License

Notifications You must be signed in to change notification settings

LLJY/sunshine-sidecar-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sidecar

Apple Sidecar-like virtual display streaming for Linux (KDE Plasma).

Creates a virtual monitor and streams it via Sunshine to any Moonlight client (iPad, Android tablet, another PC, etc.).

Warning: This currently requires a patched version of Sunshine with XDG ScreenCast-only capture support. Stock Sunshine uses a combined RemoteDesktop+ScreenCast session which fails on KDE's portal implementation. See LINK for the patch.

The current implementation of XDG screencast on sunshine (as of 2/12/25) does not appear to work on KDE, I have implemented a lazy patch HERE

Features

  • System tray app with dropdown menu for easy control
  • Resolution presets for common devices (iPad Pro, iPad Air, etc.)
  • One-click toggle to start/stop virtual display and Sunshine
  • Automatic restart if Sunshine crashes
  • Autostart support for launching on login

Requirements

System Dependencies

Arch Linux / CachyOS:

sudo pacman -S python-gobject gtk3 libayatana-appindicator krfb kscreen sunshine

Components

Component Purpose
krfb-virtualmonitor Creates virtual display output
kscreen-doctor Enables/configures the virtual output
sunshine Streams the display via Moonlight protocol
libayatana-appindicator System tray integration

Installation

./deploy.sh

# run the script in the deploy dir
$HOME/.config/sunshine/sidecar-tray.py

# Optional: enable autostart
mkdir -p ~/.config/autostart
ln -sf ~/.local/share/applications/sidecar.desktop ~/.config/autostart/

Usage

Start the tray app:

# standalone
./sidecar.py

# deploy.sh auto copies it to sunshine's .config
$HOME/.config/sunshine/sidecar-tray.py

From the system tray menu:

  1. Select resolution from the Resolution submenu
  2. Click "Start Sidecar" to create virtual display and launch Sunshine
  3. Connect from Moonlight on your device
  4. Click "Stop Sidecar" when done

Configuration

Edit the PRESETS dictionary in sidecar.py to add or modify resolution presets:

PRESETS = {
    "iPad Pro 12.9\"": (2732, 2048),
    "iPad Pro 11\"": (2388, 1668),
    "iPad Air": (2360, 1640),
    "iPad Mini": (2266, 1488),
    "1440p": (2560, 1440),
    "1080p": (1920, 1080),
    "720p": (1280, 720),
}

Other options:

DEFAULT_PRESET = "iPad Pro 12.9\""
SIDECAR_NAME = "sidecar"
SUNSHINE_BIN = "sunshine"

How It Works

Sidecar Tray App
  1. Spawns krfb-virtualmonitor (creates Virtual-sidecar output)
  2. Waits for output to appear in kscreen
  3. Enables output via kscreen-doctor
  4. Launches Sunshine (streams Virtual-sidecar)
  5. Monitors Sunshine and restarts if it crashes
       |
       v
Moonlight Client
  Connects and receives video stream

Troubleshooting

Virtual display not appearing:

  • Check if krfb-virtualmonitor is running: pgrep -f krfb-virtualmonitor
  • Check kscreen outputs: kscreen-doctor --outputs
  • View logs: cat ~/.config/sunshine/sidecar.log

Sunshine not starting:

  • Ensure Sunshine is installed and in PATH
  • Check if another instance is running: pgrep sunshine
  • Run sunshine manually to see errors

Tray icon not appearing:

  • Ensure libayatana-appindicator is installed
  • Some systems may need a system tray extension

Portal errors with Sunshine: If Sunshine shows XDG portal errors, run it without cap_sys_admin:

sudo setcap -r $(which sunshine)

License

This project is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details.

SPDX-License-Identifier: GPL-3.0-or-later

About

implements apple-like sidecar in KDE using sunshine with XDG portal support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published