How to properly restart unity?

I keep on experiencing weird bugs. These usually start after a few hours of use. Sometimes the dash starts opening under every open window (becomes only visible on desktop, but I still can search and open anything with the enter key while it's not visible). Also, there are other minor annoyances, such as random places (especially maximized Chrome, tabs area) after navigating between programs with alt+tab can't be clicked with the mouse. Switching back and forth fixes this.

I cannot use

compiz --replace

since after that, all of the app indicator icons are gone (only teamviewer stays). Skype, network, languages, sound (also keyboard sound up/down stops working) and date are gone. Restarting unity-panel-service does not help.

Any thoughts on how to resolve these?


You can press Alt+F2, then type unity, then press Enter to restart Unity.

  • Or you could use:

    sudo service gdm restart
    
  • On 14.04 and 14.10 use:

    sudo service lightdm restart
    
  • On 15.04 and 15.10 use:

    sudo systemctl restart lightdm.service
    

Try secFixWindow.sh:

secFixWindow.sh --fixcompiz

It basically

  1. replaces with Metacity,
  2. waits a bit and
  3. replaces again with Compiz.

Waiting is important to not mess with some applications like Yakuake or Cairo Dock.