If you have access to a Linux virtual terminal (Ctrl + Alt + F1 and so on), you can solve this issue without restarting the X Window System:
- Go to a virtual terminal and log in.
gnome-shell --replace --display=:0.0 &
- You may now log out again (press Ctrl + D). The new
gnome-shellwill not be affected, as it runs in the background.