How to make gnome-screenshot select area to grab after a specified delay

  • It seems that GNOME developers removed this functionality from gnome-screenshot - it does not work on 14.04 LTS, 16.04 LTS, 17.10 and 18.04 LTS) - I reported:

    1. bug 1751161 to launchpad about disabled "Grab after a delay of..." in
      gnome-screenshot -i;
    2. bug 1751157 to launchpad about option conflict in
      gnome-screeshot --area --delay 10.
  • On 16.04 LTS you can use mate-screenshot - it has delay in GUI (launched by mate-screenshot -i -a) and in terminal:

    mate-screenshot --area --delay 10
    

    but it is really ignored.

    In 16.04 LTS, 17.10 and 18.04 LTS delay is disabled when mate-screenshot ran interactively (mate-screenshot -i) - reported bug 1751245 to launchpad about this.

    In 17.10 and 18.04 LTS it works only from terminal - so I reported bug 1751141 to launchpad.

  • If you do not want to make screencast you can use the following:

    1. Open terminal and type sleep 10 && gnome-screenshot --clipboard here and click Enter;
    2. Open GIMP, paste image into it;
    3. Crop image in GIMP;
    4. Export image from GIMP to .png.
  • You can use KDE Spectacle as DK Bose suggested:

    1. Install it with sudo apt-get install kde-spectacle;
    2. Launch it from terminal with spectacle or from menu launcher.

Hope this helps.


Use another app

A work around is to use a screen recorder:

screen recorder.gif

This was made with the package called Peek

After making your .gif file you can edit it to convert a single frame into a .png or .jpg image file.


Below is a non-answer so that I can reference it elsewhere:

This script below is my workaround to misbehaved windows that do a "root X window grab". I can call it using:

screenshot.sh -d 5 -root

and it will allow me 5 seconds to fiddle with the misbehaving X window that pops up some dynamic (transient?) window and takes a full root window screenshot.

This is a non-answer to this question, because it has extra "finger burden" to crop the resulting image file down to the area of the dynamic popup using a tool such as Gimp. I need a single-shot turn-key solution that does not require me to do the same editing operation repeatedly during my workday.

This script depends upon xwd which is provided in (all?) X11 toolkits and also convert provided by (well at least on my Ubuntu 17.10 desktop install) the graphicsmagick-imagemagick-compat package:

#!/bin/bash
# -*-mode: Shell-script; indent-tabs-mode: nil; -*-

# This seems to hang on me on the RHEL6 desktop:
#
#   gnome-screenshot --window --delay=3
#
# So use xwd + convert instead:

usage () {
  echo "USAGE: $0 [ -d DURATION ] [ -root ]"
}

DURATION="3"
TARGET=""
while [ $# -gt 0 ]
do
  if [ "$1" = "-d" ]
  then
    DURATION="$2"
    shift
  elif [ "$1" = "-root" ]
  then
    TARGET="root"
  elif [ "$1" = "-h" ]
  then
    usage
    exit 0
  else
    echo "ERROR: Unrecognized option $1"
    exit 1
  fi
  shift
done

xwdOptions=""
if [ "$TARGET" = "root" ]
then
  echo "Sleeping for $DURATION seconds so that you can reposition windows for taking screenshot of root window ..."
  xwdOptions="-root"
else
  echo "Sleeping for $DURATION seconds so that you can raise the appropriate window ..."
fi
sleep $DURATION

timestamp="$(date +%Y-%m-%d.%H-%M-%S.%Z)"
screenshot_path="$HOME/screenshot.$timestamp.png"

# Per https://askubuntu.com/questions/962848/imagemagick-identify-fails-to-identify-xwd-images#comment1542670_962848 :
xwd $xwdOptions | convert xwd:- $screenshot_path

echo
echo "SCREENSHOT:       $screenshot_path"
echo
#echo 'Alternatively, use the ImageMagick "import the_output.png" command to select a region'