How can I restart Compiz from a TTY? (& Related, how can I set up a fallback WM?)

I'm testing Natty, and Compiz keeps crashing on me. However, it doesn't always give me the option to restart Compiz, and for some reason doesn't have a fallback window manager(WM) configured.

Without a WM, all my programs are still running, but they're not accepting input from the keyboard, and I can't switch between them.

I can, however, press Ctrl+Alt+F1 and get a terminal, and I can killall Xorg to reset everything; but, I'd rather just reset Compiz, if possible.

If I try typing compiz --replace in the TTY, it complains "fatal--couldn't open display." Is there a way to have TTY1 restart Compiz? Like compiz --replace --display=something?

Additionally, is there a way to configure a fallback window manager so that there's an easier way to recover from Compiz crashing?


Switch to terminal number 1 (Ctrl+Alt+F1) and run

DISPLAY=:0 unity --replace 

or

DISPLAY=:0 compiz --replace

Sometimes it doesn't restart. Just kill all compiz processes and try again in case.


You need to set the DISPLAY environment variable, in the usual case of a single Xorg instance you can do that with

export DISPLAY=":0.0"