Skip to content

Instantly share code, notes, and snippets.

@Dregu
Last active July 21, 2025 23:00
Show Gist options
  • Save Dregu/4c0dbb2582835e5d95e06c4bf7624e3b to your computer and use it in GitHub Desktop.
Save Dregu/4c0dbb2582835e5d95e06c4bf7624e3b to your computer and use it in GitHub Desktop.
Scripts for automatic sunshine virtual display on sway or hyprland with custom resolution matching moonlight client
# make sure sunshine is using "wlr" capture mode to see headless displays
# create a new "Headless" app in sunshine for virtual display and set:
# do commands
sh -c "hyprctl keyword monitor HEADLESS-2,${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS},auto,1"
hyprctl keyword monitor eDP-1,disable
# matching undo commands
hyprctl keyword monitor HEADLESS-2,disable
hyprctl reload
# now you can connect to the real "Desktop" app or the "Headless" screen
# that automatically matches moonlight client res and disables real display
# configure your real monitor
monitor = eDP-1,preferred,auto,auto
# configure your virtual monitor, you probably want this to start disabled cause you can't see it
monitor = HEADLESS-2,disable
exec-once = hyprctl output create headless
# duh
exec-once = sunshine
# blah blah rest of your hyprland config
# make sure sunshine is using "wlr" capture mode to see headless displays
# create a new "Headless" app in sunshine for virtual display and set:
# do commands
sh -c "swaymsg output HEADLESS-1 enable; swaymsg output HEADLESS-1 mode ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}Hz"
swaymsg output eDP-1 disable
# matching undo commands
swaymsg output HEADLESS-1 disable
swaymsg output eDP-1 enable
# now you can connect to the real "Desktop" app or the "Headless" screen
# that automatically matches moonlight client res and disables real display
# configure your real monitor
output eDP-1 mode 1366x768
# configure your virtual monitor, you probably want this to start disabled cause you can't see it
output HEADLESS-1 mode 1920x1080 disable
exec swaymsg create_output HEADLESS-1
# duh
exec sunshine
# blah blah rest of your sway config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment