Skip to content

Instantly share code, notes, and snippets.

@iamthenuggetman
Last active January 8, 2026 14:02
Show Gist options
  • Select an option

  • Save iamthenuggetman/6d0884954653940596d463a48b2f459c to your computer and use it in GitHub Desktop.

Select an option

Save iamthenuggetman/6d0884954653940596d463a48b2f459c to your computer and use it in GitHub Desktop.
Sunshine on Bazzite with virtual display
  1. First connect whatever display you want to use Moonlight on. I'll be using a 65" Roku TV. I connected it to my laptop running Fedora and after my system detected it I use for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; done to find which directory has the EDID file for me it's HDMI-A-1

  2. Copy that edid file to your home directory cp /sys/class/drm/card0-HDMI-A-1/edid ~/. Now get that edid file over to your Bazzite (streaming machine). I used LocalSend to transfer it.

  3. Create a directory to store this new edid file sudo mkdir -p /usr/local/lib/firmware then place the file in there sudo mv ./edid.bin /usr/local/lib/firmware/

  4. Add this new edid to your kernel args sudo rpm-ostree kargs --append-if-missing="firmware_class.path=/usr/local/lib/firmware drm.edid_firmware=HDMI-A-1:edid.bin video=HDMI-A-1:e"

  5. Reboot systemctl reboot. After you log back into Bazzite open up your Display Configuration window (right-click on desktop) and notice you have an additional display set your virtual display to Mirror/Replica your primary.

  6. Configure Sunshine so we force all our games to use the virtual display instead of our primary when using Moonlight. Open a terminal and run kscreen-doctor -o | grep Output: look for your virtual screen id. In my case it's HDMI-A-1.

  7. Right-click Sunshine icon in your tray and select "Open Sunshine" go to Configuration page. Once there click on the General tab and click + Add to put a "Do" and a "Undo Command".

  8. For your "Do" command you want to disable your primary display(s) and only enable your virtual display (this will force games to launch on the correct screen with correct resolution). In your "Undo" command you want to do the opposite (i.e. disable your Virtual Display and enable your primary display(s)). Below are my Do and Undo commands:

Do:

/usr/bin/kscreen-doctor output.DP-2.disable && /usr/bin/kscreen-doctor output.HDMI-A-1.enable

Undo (make sure you re-enable your Virtual Display as well):

/usr/bin/kscreen-doctor output.DP-2.enable
  1. Test on Moonlight to verify everything works as expected.

(citation: https://www.reddit.com/r/linux_gaming/comments/199ylqz/streaming_with_sunshine_from_virtual_screens/)

@beans1013
Copy link

Thank you! , this works perfectly for me running gnome.

@iamthenuggetman
Copy link
Author

awesome to hear! i completely forgot that i even wrote this lmao

@beans1013
Copy link

awesome to hear! i completely forgot that i even wrote this lmao

Saved me from spending 10 euros for a dummy plug

@Kup86
Copy link

Kup86 commented Sep 28, 2025

It worked great Thank you! Just a question - How do I remove the 'virtual dummy display'? I accidentally created two and one to remove one. Thanks again!

@iamthenuggetman
Copy link
Author

@Kup86 try rpm-ostree kargs --editor and delete the extra one

@Kup86
Copy link

Kup86 commented Oct 1, 2025

@iamthenuggetman Thank you! That worked great! Handy for anyone that gets in the same predicament - Thanks again for this post it is ultra helpful!

@MalikKillian
Copy link

@iamthenuggetman Great guide! One key thing to mention (called out in the Reddit post but not here) is that the chosen device needs to be unused. For a headless setup this is perfect but not if a 2nd "always on" virtual monitor is needed.

@iamthenuggetman
Copy link
Author

@iamthenuggetman Great guide! One key thing to mention (called out in the Reddit post but not here) is that the chosen device needs to be unused. For a headless setup this is perfect but not if a 2nd "always on" virtual monitor is needed.

thanks Malik, good call out!

@cavazos-apps
Copy link

this is exactly what I needed, thank you! My only problem is that when I reenable my monitors, the arrangement isn't always the same as it was before. Is there any way to ensure this?

@iamthenuggetman
Copy link
Author

this is exactly what I needed, thank you! My only problem is that when I reenable my monitors, the arrangement isn't always the same as it was before. Is there any way to ensure this?

this is the script i have trigger

#!/bin/bash
PS1="[wayland-shell] \w\$ "
export XDG_RUNTIME_DIR=/run/user/1000
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
export QT_QPA_PLATFORM=wayland
export WAYLAND_DISPLAY=wayland-0

/usr/bin/kscreen-doctor output.HDMI-A-1.mode.1920x1080@60
/usr/bin/kscreen-doctor output.HDMI-A-1.enable
/usr/bin/kscreen-doctor output.HDMI-A-1.position.721,1440

hope it helps

@bighugesumo-sketch
Copy link

thanks, i followed the guide and it works but i get a black screen after a reboot and i have to plug the cable in a different hdmi, switch desktop from gaming mode and only then i can access the desktop and start streaming off sunshine. Any tips on how to avoid that?

@iamthenuggetman
Copy link
Author

iamthenuggetman commented Nov 18, 2025

thanks, i followed the guide and it works but i get a black screen after a reboot and i have to plug the cable in a different hdmi, switch desktop from gaming mode and only then i can access the desktop and start streaming off sunshine. Any tips on how to avoid that?

sounds like the wrong display is getting set as primary or it is disabled. try SSH’ing in save this script as enable-wayland.sh

#!/bin/bash
loginctl activate 1
export XDG_RUNTIME_DIR=/run/user/1000
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
export QT_QPA_PLATFORM=wayland
export WAYLAND_DISPLAY=wayland-0
echo "[+] Wayland session env loaded. Run display tools from here."
exec bash --rcfile <(echo 'PS1="[wayland-shell] \w\$ "; export XDG_RUNTIME_DIR=/run/user/1000; export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export QT_QPA_PLATFORM=wayland; export WAYLAND_DISPLAY=wayland-0')

then do bash enable-wayland.sh now you have a faux wayland shell and you can use kscreen-doctor -o to see what your display configuration looks like and even enable/disable them over SSH

@pflavio
Copy link

pflavio commented Nov 18, 2025

Any way to add multiple displays? I tried and when I do, all screens are black but do have sound. The iGPU is disabled. If I only set up one screen it works fine.

@iamthenuggetman
Copy link
Author

Any way to add multiple displays? I tried and when I do, all screens are black but do have sound. The iGPU is disabled. If I only set up one screen it works fine.

not sure i understand the question, are you saying multiple virtual displays? or one physical and one virtual? i currently have 1 physical (DP-4) and one virtual (HDMI-A-1) and it works. can you elaborate a bit more?

@pflavio
Copy link

pflavio commented Nov 18, 2025

Any way to add multiple displays? I tried and when I do, all screens are black but do have sound. The iGPU is disabled. If I only set up one screen it works fine.

not sure i understand the question, are you saying multiple virtual displays? or one physical and one virtual? i currently have 1 physical (DP-4) and one virtual (HDMI-A-1) and it works. can you elaborate a bit more?

Oh yes sorry. Multiple virtual displays. I actually don't use any real display at all, I used to use a dummy plug (but will ditch it for this regardless, even if I'll just end up with one virtual display).

@iamthenuggetman
Copy link
Author

i think you can do multiple virtual displays but i never tried it. maybe you need different or altered EDIDs though if there’s an identifier in there or something 🤷‍♂️

@pflavio
Copy link

pflavio commented Nov 18, 2025

i think you can do multiple virtual displays but i never tried it. maybe you need different or altered EDIDs though if there’s an identifier in there or something 🤷‍♂️

Thanks anyway. :) Yes I have multiple EDID for the displays where I ultimately want to stream to. Both HDMI and DP ones. Maybe someone else has an idea. :)

@bighugesumo-sketch
Copy link

thanks, i followed the guide and it works but i get a black screen after a reboot and i have to plug the cable in a different hdmi, switch desktop from gaming mode and only then i can access the desktop and start streaming off sunshine. Any tips on how to avoid that?

sounds like the wrong display is getting set as primary or it is disabled. try SSH’ing in save this script as enable-wayland.sh

#!/bin/bash
loginctl activate 1
export XDG_RUNTIME_DIR=/run/user/1000
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
export QT_QPA_PLATFORM=wayland
export WAYLAND_DISPLAY=wayland-0
echo "[+] Wayland session env loaded. Run display tools from here."
exec bash --rcfile <(echo 'PS1="[wayland-shell] \w\$ "; export XDG_RUNTIME_DIR=/run/user/1000; export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export QT_QPA_PLATFORM=wayland; export WAYLAND_DISPLAY=wayland-0')

then do bash enable-wayland.sh now you have a faux wayland shell and you can use kscreen-doctor -o to see what your display configuration looks like and even enable/disable them over SSH

Thanks, im a total noob, i removed the edid from kargs as i was mostly chatgpting my way into these issues but i still havent found a reliable solution. basically i want to stream my bazzite pc using sunshine to my steamdeck and to my tv. Tried both your guide with edid and with a dummy plug but in both cases my pc gets a blank screen after reboot and i have to either remove the dummy plug from the hdmi port or switch port from hdmi to bypass gaming mode and only after that my hdmi shows the desktop. maybe mirroring would do it im not sure..

@TheBacon00
Copy link

Hey question for you — should kscreen-doctor work when in Steam Game Mode? I’m running Bazzite and when I try to run any Do/Undo commands with kscreen-doctor like you suggested, they work great in desktop mode, but when the device is in Game Mode, those commands fail. I assume there’s some complexity here about what is/isn’t running in Game Mode but I’m very unfamiliar with these programs. I was hoping to set up a virtual display just like you suggested but I can’t figure out how to turn off the real display when it game mode.

@Silvenga
Copy link

@TheBacon00 kscreen-doctor won't work because KDE isn't running when bazzite is running in game mode (wayland only).

One sub-optimal solution is to tell gamescope to output onto the virtual port.

#!/bin/bash

VIRTUAL_DISPLAY="DP-2"
echo "OUTPUT_CONNECTOR=$VIRTUAL_DISPLAY" > ~/.config/environment.d/10-gamescope-session.conf

systemctl --user restart gamescope-session.target

The problem is that gamescope will force a restart of sunshine internally, so this can't be executed as a do/undo command or gamescope will segfault.

I suspect the real solution for us is to get wayland to switch displays somehow, not sure how though (and hope that gamescope can handle the switch). I do know that turning off the displays via drm has no effect.

@wnoffsinger1
Copy link

wnoffsinger1 commented Dec 5, 2025

Hey quick question if you don't mind answering. It may be dumb...

So when I first connect with a device to sunshine it just mirrors my display 2 (HDMI-A-2) , and doesn't extend the view.

So first question is do I need to connect to a separate linux (or windows) computer over sunshine/moonlight to get a virtualdisplay? i usually connect through Apollo/Artemis on windows to automate the virtual display for me.

My second has to do with the edid file. You write it as a .bin file, but mine that I got from my other monitor to test is just an edid (unknown) file type and not .bin . Is there a setting like in windows to show the file type extension?

EDIT: OK i got a virtual display working i think.. it shows up on my display settings but doesn't output to my connected device. it kinda just sits there.

@deisi
Copy link

deisi commented Dec 17, 2025

Hey guys, I had some issues with this under bazzite gnome. Mostly the fact that kscreen-doctor is a kde application and not available. However instead one can use gdctl. As there is very little reference on how to use gdctl I thought I drop some of the config lines I started to use.

e.g. I use:
gdctl set --logical-monitor --primary --monitor DP-3 --mode 2560x1440@119.953
and
gdctl set --logical-monitor --primary --monitor DP-3 --mode 3440x1440@144.000

To change the resolution of my real monitor. To switch to the virtual monitor I use:
gdctl set --logical-monitor --primary --monitor HDMI-1 --mode 4096x2160@60.000 --scale 2.0

With gdctl show -v one gets an overview about the available monitors and the corresponding modes.

@Silvenga
Copy link

Silvenga commented Dec 20, 2025

So this is kind of fun for users of Bazzite in steam deck mode (so just gamescope acting as wayland). You can force gamescope over to the virtual display doing something like (as root):

find /sys/kernel/debug/dri -name "force" | grep "HDMI-A-1"
echo off > /sys/kernel/debug/dri/0000:03:00.0/HDMI-A-1/force
udevadm trigger --subsystem-match=drm

# And to enable again
echo on > /sys/kernel/debug/dri/0000:03:00.0/HDMI-A-1/force
udevadm trigger --subsystem-match=drm

This assumes the virtual display is active. You should see steam re-scale and your TV go disconnected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment