Switch window manager while running

window-managerx-server

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?

Best Answer

Switching window managers is supported by all X window managers; typically it involves running them with a --replace argument, so they replace the currently-running window manager:

metacity --replace &

Depending on how your X session started, you could kill the current window manager and start a new one, but for that to work, you need to be sure that killing the window manager won't stop your X session, and you also need to be sure that the terminal you're using (xterm or whatever) will still have the focus after the window manager is gone.

Related Question