Screenshot problem Ubuntu 16.04

When I want to take a screenshot with gnome-screenshot of my browser (chromium), pdf-viewer (Document Viewer), nautilus or even texmaker it takes a screenshot of the desktop or the window behind the current active window and sometimes it works as desired. This happens with the options "Grab the whole screen", "Select area to grab" and "Grab the current window". For all three options the behavior is not the same every time! Here is a summary of the 3 behaviors:

  • screenshot of desktop through actual active window and the windows behind
  • screenshot of the window behind the actual active window
  • screenshot of actual active window (desired event!)

EDIT1: new behavior found taking a screenshot ("select area to grab") of my clock in the task-bar.

picture taken at 10:35:30: enter image description here

picture taken at 10:35:40 (10 seconds later): enter image description here

picture taken at 10:40:34 (10 minutes later): enter image description here

It appears to take on two different times a picture of a old "frozen" screen with the same time displaying on the clock (time: 10:14:43).

HELP!


EDIT2: took a screencast with simplescreenrecorder to document the my problem/bug

here the link to the video

Looking at the video i noticed a flickering between two screens but while taking the screencast never saw a flickering. It flickers between the actual screen (right time in the menu bar) and a old screen from the "past" (wrong time in the menu bar).

I have:

  • nvidia GM107GLM Quadro M1000M
  • intel graphic HD P530 chip

I'm using nvidia-367 367.35 driver.


I used to have this problem on an XPS 15 9550 with ubuntu 16.04. I tried to update to 16.10 to see if the problem was solved, but the upgrade did not go well so I reverted to 16.04 (thanks to Timeshift).

However I solved it by following ComBin's answer here

sudo apt-get purge xserver-xorg-video-intel

(actually I also removed the file "/usr/share/X11/xorg.conf.d/20-intel.conf", which I had previously tweaked)

The solution is basically to remove the intel driver and resort to modesetting, it should be the default behavior in new ubuntu versions (maybe it already is in 16.10, I didn't check): https://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Debian-Abandon-Intel-DDX

Note that this also solves problems with the switching of gpu via nvidia-prime (see here)


Getting a screenshot of the actual active window (your desired event) with Ubuntu 16.04 and gnome-screenshot is as simple as holding Alt and Tapping PrtSc You will be prompted where to save the screenshot. Try it, it works.

Edit: Ctrl PrtSc will result in the entire visible desktop being copied to the clipboard and you can paste the image into whatever document you desire.

ShiftCtrlPrtSc will provide a crosshair that you can use to select a portion of the screen to capture to the clipboard which again you can paste into whatever document you desire.

Tested on fresh install of 16.04.1

Alternatives to gnome-screenshot can be found here.