How to use iMac as external monitor for ubuntu laptop

I had the exact same problem. I got this working reliably with a combination of xpra and Xephyr. This solutions of course uses your local network, through ssh, to make an remote display.

You need xpra installed on both of your devices and Xephyr on your Ubuntu machine. There is a repo for Ubuntu, which installs Winswitch - which xpra is part of. Winswitch has quite a few cool features.

Anyway here is how I got it to work:

On your Ubuntu machine in terminal:

xpra start --exit-with-client=yes --speaker=disabled --start-child="Xephyr :200 -ac -screen 1920x1080" :100

DISPLAY=:200 lightdm-session 'gnome-session --session=ubuntu'

Where "200" is the X11 port which Xephyr connects to, and "100" is the port made available over the local network.

On your Mac in terminal:

/Applications/Xpra.app/Contents/MacOS/Xpra attach ssh:[email protected]:100

Needless to say a this solutions is dependent on a wired network.