Years ago (around 2000) I saw a guy at a Linux meeting do an amazing X-windows trick which I've never seen repeated since.
While he was logged into his default window manager (let's say Gnome), he opened some programs (e.g. xterm, xclock, xeyes), and then from the xterm window he issued some commands to stop Gnome but leave all the open windows in place on the desktop (the desktop then showed the standard X course-gray background). He then typed (still in xterm) the commands to start a different window manager (let's say KDE) and, lo and behold, the whole new window manager picked up all the open windows, rendered the background, taskbar, and window buttons with the new manager's desktop theme.
I don't know if this was switching from Gnome to KDE or other window managers but it showed the independence of the window manager and the x server.
What are the commands to safely unload and reload a window manager in this fashion? Can this still be done with today's window managers?