Often compiz will crash and leave the keyboard useless. Normally I drop to the console and restart GDM.
Is there a solution where I can start Compiz back up without losing everything in the current session?
compiz --replace &
That's how I usually restart Compiz when it crashes and I can still use the keyboard.
(If you have a tip on how to prevent Compiz from crashing I've posted here https://askubuntu.com/questions/42096/fresh-install-of-11-04x64-displaycompiz-constantly-failing
??? - Am I right that Compiz is failing or is it X?
If it's "just" a compiz crash, you should be able to restore it from one of the TTYs, even if the keyboard isn't working in X.
hit ctrl+alt+F1 to get to the console
Login with your usual username and password
Type the following:
DISPLAY=:0.0 compiz --replace &
If compiz is still really hanging, you may need to kill it with more authority and try again:
killall -9 compiz
DISPLAY=:0.0 compiz --replace &
Then hit Alt+Left Arrow until you get to the screen where X is running.
If the mouse is still working after such a crash you could add a starter for
/usr/bin/compiz --replace
so you can start with a mouse click.My solution is similar to Eric's solution.
Except I do just type "unity" as it seems to work a lot better for me:
For me it looks a mess for about 20 seconds. But then, I actually get back all my windows and can continue working like nothing happened.
"DISPLAY=:0.0 compiz --replace &" Did not work for me and I lost a lot of the functionality.
"sudo service lightdm restart" restarts the whole thing and you loose all your windows. Maybe its faster than rebooting.
I believe that compiz is really the issue here and has something to do with too many tabs open. If I flick back to the terminal, I can actually see this bug: "intel_do_flush_locked failed no space left on device" A few people are complaining about it around the internet.
There is this script secReplaceWindowManager.sh.
Each 10s it will check if there is a window manager running, if not, it will start it; you can also replace them at will (currently it supports compiz and metacity).
It is interactive so requires to be run on ex. a xterm like
xterm -bg darkorange -e "secReplaceWindowManager.sh;bash"&disown
.