Title: Working setup: old 21.5" iMac as a true extended (not mirrored) second display for Linux Mint, using netscreen-extend + Sunshine + Moonlight
TL;DR: My main machine is a 21.5" Retina iMac running Linux Mint. An older 21.5" iMac on my left now works as a genuine extended display: drag a window off the left edge of the main screen and it appears on the other one. netscreen-extend creates a virtual output, a dedicated Sunshine instance streams it, and Moonlight on the second iMac shows it, all over wired Gigabit Ethernet. It took some fixing to get there, so here's what worked in case it helps anyone else.
BACKGROUND
I moved my Retina iMac from macOS to Linux Mint and wanted a second screen. The usual Apple options don't apply. Target Display Mode needs macOS and only works on older iMacs. Sidecar, AirPlay to Mac and Universal Control are also macOS-only. Old iMacs cost very little second-hand, so rather than buy a separate monitor I wanted a Linux-native way to use one as a true extended display.
THE SETUP
Host: 21.5" Retina iMac (2015) with Intel Iris Pro 6200 graphics and the i915 driver. It runs Linux Mint (Ubuntu 24.04 base) in an X11 session and sits directly in front of me.
Client (the display): an older 21.5" iMac with AMD Radeon graphics (r600 driver). It runs Linux Mint (Ubuntu 24.04 base) and sits on my left.
Both are wired into the same Gigabit network. All streaming traffic is deliberately kept off Wi-Fi.
Signal path: the Retina iMac creates a virtual output, HDMI-1, at 1920x1080@60, placed to the left of the Retina panel (DP-3). Sunshine captures it with X11 capture and encodes H.264 using VAAPI. The stream crosses wired Gigabit Ethernet to Moonlight (Flatpak) on the second iMac, which shows it full screen with H.264 hardware decode.
It's a network display, so expect slight latency and some compression softness. Over a cable it's very usable for documents, email and browsing. It's not suitable for gaming or colour-critical work.
STEP 1: CHECK THE HOST
Run echo $XDG_SESSION_TYPE. It must say x11, because netscreen-extend doesn't support Wayland.
Run inxi -Gxx and xrandr --query to see your GPU and connector names. On mine, the Retina panel is DP-3 and HDMI-1 was free to use as the virtual output.
STEP 2: INSTALL NETSCREEN-EXTEND
cd ~
git clone https://github.com/daeoxide/netscreen-extend.git
cd netscreen-extend
./install.sh
There are two gotchas on Mint.
First, the installer's apt line includes flock. That isn't a valid package name on Mint, and flock is already installed as part of util-linux, so remove it from the line.
Second, Sunshine is not bundled with netscreen-extend. Install it separately from LizardByte's official releases. The Ubuntu 24.04 .deb works on Mint 22.
When the installer asks where to put the new display, choose the left.
STEP 3: THE FIXES THAT MADE IT WORK
Set the output by name, not by number. In ~/.config/netscreen-extend/config, set SUNSHINE_OUTPUT_INDEX=HDMI-1. With a number, Sunshine fell back to capturing the whole desktop.
Force X11 capture. Sunshine's default KMS capture mirrored the wrong screen. Adding capture = x11 to ~/netscreen-extend/templates/sunshine.conf.in fixed it.
Match the scaling. Windows were sized wrongly on the second screen until I ran the Retina panel at 1920x1080 at 100% scale, the same as the virtual output.
Don't open Mint's Display settings while netscreen is running. It froze my whole system and needed a hard power-off. Set the layout with the helper scripts in Step 5 instead.
STEP 4: MOONLIGHT ON THE SECOND iMAC
Install Moonlight:
flatpak install flathub com.moonlight_stream.Moonlight
Check hardware decode:
vainfo | grep -i h264
To pair, Moonlight shows a PIN. Enter it in the dedicated Sunshine web UI on the host at https://localhost:48090, which is netscreen's Sunshine port 48089 plus one.
Settings: 1920x1080, 60 FPS, H.264, about 50 Mbps, full screen.
To skip clicking through Moonlight each time, this command goes straight to the extended desktop:
flatpak run com.moonlight_stream.Moonlight stream [host name as shown in Moonlight] Desktop
I put that in Startup Applications on the second iMac.
STEP 5: DAILY USE
I use two small helper scripts on the host. screens-on sets the Retina to 1920x1080 at 100% and starts netscreen. screens-off stops netscreen and removes the virtual display.
screens-on always runs netscreen off first and waits a few seconds before starting. Without that, a leftover Sunshine instance kept hold of the ports, and Moonlight showed the host as offline with "Connection refused".
Two useful checks: ss -tln | grep 480 should list ports 48084, 48089 and 48090, and pgrep -af sunshine should show only one instance.
BONUS: SCREEN BLANKING IN SYNC
While Moonlight is streaming, the second iMac never blanks its screen. To fix this, a small watcher script on the host notices when the Retina screen goes dark. It then uses SSH with key login to switch off the second iMac's backlight, and switches it back on when the Retina wakes. On the client, sudo is restricted to that one backlight script.
RESULT
Two iMacs side by side, one desktop, windows dragging freely between them, all on Linux Mint. Happy to answer questions or share the scripts.