The problem#
For various reasons you might want graphical access to another computer, since some things can't be done over a text interface, including actually designing and troubleshooting what the graphical interface looks like. The other computer might be in a remote location across the internet, in a different room, or simply have a less convenient form factor like a tablet or television, so it's easier to use your desktop's keyboard, mouse, and monitor.
The solution#
The standard solution for this is VNC, specifically the
x11vnc
VNC server.
To keep a VNC server open to the current X11 session:
x11vnc -usepw -nevershared -forever -localhost -loop &
#... (run one or more graphical applications that block)
# When done, kill everything.
rkill $$
Then to connect to it, assuming the hostname is tablet
and you're set
up to connect to it via SSH:
$ vncviewer -via tablet -passwd ~/.vnc/tab-passwd localhost
This assumes you've created a ~/.vnc/passwd
password file on the
server by running
$ x11vnc -storepasswd
and entering something at the prompt from your favorite password
generator. No need to save the password anywhere as the file itself is
the actual password; just copy it to the client at ~/.vnc/tab-passwd
to match the path used in the example above.