While writing up my mxconns post, I ran across the *ease of
(ab)using X11" articles (1 and 2) Brian Hatch posted in 2004.
In the first part, he walks you through DISPLAY and xauth, which
I'd seen before, but the second part contained more nice tricks. The
difficulty here is remembering all the useful little utilities for
manipulating X. Here's a quick list:

xmessage for popping up dialog windows

xlsclients -l for listing all connected clients (this is how you
get those window ids!)