Sunshine Snake Glue
(Yes it's a silly name)
What's This?
A tool that changes the resolution of a Sunshine host to an approximation of the client Moonlight resolution.
What is Sunshine and Moonlight?
TLDR: Sunshine is an ultra low latency display streaming server, and Moonlight is a client for it. I get around 1ms~ when using it for my tablet as a second display.
What Does This Support?
Linux, specifically only GNOME's Wayland session at the moment (and in a very hacky state...).
Support list:
| Compositor | Support |
|---|---|
| GNOME | ⚠️ (Work in progress / Hacky) |
| KDE Plasma | ❌ |
| Sway | ❌ |
| Hyprland | ❌ |
X11?
I don't think I'll ever extend this to support X11. Sunshine has options to interact with an X server, Wayland compositors tend to be much stricter, and this is just a middle layer to make that communication pleasant. Sunshine's documentation even has instructions for X11. Yes, it does mention GNOME's Wayland session, but it makes the bold assumption that the client has an exact match with a resolution/refresh rate the compositor offers.
Dependencies
A version of GNOME that supports gdctl. That's all! Presumably you have python3, right?
Usage
Arguments
setchanges the resolution of the given display adaptercreategenerates a script, filling placeholders documented below. (It aligns the application with the matched resolution, not Sunshine's internal resolution info)resetsets the resolution of the provided adapter back to what it was before connecting.
Common Usage
[path] represents the full path of sunshine snake glue for brevity.
[display adapter] represents the adapter identifier that Sunshine internally uses.
[string with placeholders] is self explanatory.
Do Instructions
Do: python3 [path] set [display adapter]
Do: python3 [path] create [display adapter] [string with placeholders]
(This saves a file in ~/.sunshine-snake-glue called script.sh, and sets its permissions accordingly.)
Undo Instructions
Undo: python3 [path] reset [display adapter]
Possible Placeholders
{res_x}(The horizontal resolution.){res_y}(The vertical resolution.){rate}(The refresh rate.)
Example Usage
Do:
python3 /home/agrey/Development/sunshine-snake-glue set HDMI-2
python3 /home/agrey/Development/sunshine-snake-glue create HDMI-2 "gamescope -f -W {res_x} -H {res_y} -r {rate} -e -- steam -bigpicture -steamos3"
Command:
/home/agrey/.sunshine-snake-glue/script.sh
Undo:
python3 /home/agrey/Development/sunshine-snake-glue reset HDMI-2