1) Restart the laptop touchpad or USB mouse [1]
This can be done via the command line and does not require you to reboot or logout of your account.
To restart the laptop touchpad -
- Open terminal (ctrl + alt + t) or press alt + f2 to bring up unity's command lens.
- Execute the following commands (recommended to run using gksudo but can be run using sudo as well) -
- gksudo modprobe -r psmouse (removes the mouse interface from the linux kernel)
- gksudo modprobe psmouse (adds the mouse interface to the linux kernel)
- Open terminal (ctrl + alt + t) or press alt + f2 to bring up unity's command lens.
- Execute this command -
- sudo /etc/init.d/hotplug restart
2) Uncheck the 'Disable touchpad while typing' option [2]
This setting is specific to the laptop touchpad.
- Go to System Settings -> Mouse and Touchpad (under Hardware section)
- Click on the Touchpad tab and uncheck the Disable touchpad while typing option.
3) Ensure that the Unity HUD or any other Unity lens is off
I was watching a video in VLC fullscreen mode. I primarily use VLC's keyboard commands - ctrl + navigation keys & alt + navigation keys - to move around the playback. During playback I abruptly switched to another app. That's when I faced this problem yet again. I had already unchecked the option as mentioned in step 2 above sometime ago. I tried restarting my mouse by running the commands mentioned in step 1, but that didn't work as well.
While I was using the browser via my keyboard (alt + tab to the rescue) and searching google for help, I happened to press escape 2-3 times and lo and behold, the mouse started working again.
And then it struck me! Whenever you have any unity lens open - the application, video, audio lens or even the HUD - the only areas where you can click with the lens open are the unity panel on the left hand side and the top menu bar. You cannot click anywhere in the app display area when any lens is open. These were exactly the symptoms I was facing and it seems that pressing the escape button multiple times closed a lens which was open in the background (probably when VLC was in fullscreen mode).
To reproduce the above mentioned problem - open a video in VLC and switch to fullscreen mode. Press alt once - this does bring up the HUD for VLC, but it does not show up in front. Now since the HUD is active (but not visible though), you won't be able to use any keyboard commands in VLC! Press escape once which will close the HUD and you'll be able to use VLC keyboard commands again.
Alternatively, you can just open the unity lens once (by pressing the Windows/super button) and close it. This should fix the issue.
References -
[1] Restarting your touchpad/mouse in Ubuntu in simple steps
[2] Trackpad freezes often [closed]