Gnome Screenshot – Gnome-Screenshot Taking Shots Randomly, Affecting Google Sheets

16.04gnomegnome-screenshotgoogle-chromenautilus

I'm having a weird problem since the last week or so on my Ubuntu 16.04 laptop.

Out of the blue, gnome-screenshot starts taking shots of the screen – continually. I used to think it only happens when I'm working on Chrome(which is like 95% of the time the system is on), but today it happened almost instantly after the system booted and I entered my password.

It happens randomly sometimes, or sometimes when I press a key. It's very annoying.

I have uninstalled the package, which was at version 3.18.0.

Also simultaneously, a weird problem has started in Google Sheets. After a sheet is loaded, the currently selected cell is cleared and the cursor starts blinking, as if someone double-clicked the cell. When I select a new cell, it waits a second and clears and edits that cell as well. Last time it happened when I uninstalled gnome-screenshot because of the above random-screenshots problem.
Then I reinstalled gnome-screenshot and the Sheets problem disappeared as well as the screenshots problem. Now, both problems are back simultaneously and for the time being I've uninstalled gnome-screenshot, but the Sheets problem remains.

I don't know why this is happening, but I think it's some kind of system call which is misinterpreted or some bug in some package.

I think this has started happening since I last ran the package updater.

Any solutions? I'm pretty sick of the situation as it is now.

P.S. Just noticed its effects in Nautilus as well. When I go into a folder and want to go back to the home directory(or any other in the parents), I can't; instead the mouse pointer just starts blinking very rapidly(several times a second on/off).

I also can't open any menus in the taskbar or anything. If I try to open a menu(e.g. to shut the computer down) it stays for a split second and then closes again. This happens again if I try to reopen.

Best Answer

Your Prt Sc key (or whatever it is labelled on your keyboard) is most likely faulty. When gnome-screenshot is installed, that key initiates a screenshot and is not propagated to applications. When it is uninstalled, the key press is ultimately propagated to Google Sheets which results in clearing and editing the selected cell. When pressed continously, it will also prevent you from navigating in nautilus' location bar and immediately close taskbar menus.

To confirm this, install evtest, run sudo evtest in a terminal and select your keyboard. Leave it running. As soon as the problem occurs, don't press any key and switch to the terminal. There will be lines containing KEY_SYSRQ.

The obvious solution is of course replacing the keyboard. However, if it is a builtin laptop keyboard, that may not be an option.

As a workaround, you can remap the key's scancode to a key that usually has no effect, like unknown. I have written instructions for this here. Keep in mind, though, that you won't have a SysRq key then, unless you remap another key (maybe one you never use) to SysRq. This won't prevent the faulty key from sending X key events and it will still interfere with nautilus (but not the taskbar).

Another workaround would be disabling the whole keyboard using xinput --disable [id] where [id] is the device's id you can obtain with xinput list. You'll then have to use an external keyboard, but the faulty key's events are not propagated beyond the X server and won't interfere with applications.