My desktop environment (Gnome?) is non-responsive. I tend to plug and unplug the mouse and keyboard frequently. I just plugged in the mouse and keyboard, and the computer came out of sleep, but is not responding to mouse clicks or to the keyboard (both are USB).
The mouse does move the cursor around, but clicking has no effect.
When I unplug and plug in the keyboard, the lights on the keyboard momentarily flash, but other than that the GUI (virtual console 7) does not react to the keyboard at all. Note that if I switch to different virtual console with Ctrl-Alt-F1 or F2, then it works and the keyboard works fine. Basically Gnome seems to be in some kind of sleep or suspend state in which it is not reacting to input.
I can connect to the machine from a remote machine via SSH and everything seems normal, at least from the SSH terminal.
How can diagnose what is going wrong and either fix it, or restart the desktop environment if necessary?