It turns out amazingly uneasy to make a screenshot on which the mouse cursor (pointer) is visible. No one of the typical Linux/Ubuntu screen capture programs does that. I even saw suggestions to run the application inside vmware or virtualbox to make such a screenshot!
There is a better alternative.
Instead of making a screenshot, one should record the short video animation. Those record cursors properly. Then the static image can be extracted from the video.
Recording the video
gtk-recordMyDesktop (it is packaged,
gtk-recordMyDesktop), configure it to grab the appropriate part of
the screen (in most cases just use the
Select Window button), start
recording, make sure the situation which you would like to shot
lasts for at least a moment, stop recording (left click on the grey rectangle
icon in the panel to which
Your animation will be saved to
~/out.ogg.2, ... if such file
was already present).
In newer recordMyDesktop versions it is
~/out.ogv. Whichever extension is used, this is the Theora-encoded video.
Extracting the image from the video
The only remaining thing is to extract the individual image (frame) from the video.
The simple way to achieve this is to open the video in
vlc (also packaged,
apt-get install vlc):
$ vlc ~/out.ogg
play the video, pause it on the correct frame, and pick
Video/Snapshot from the menu.
VLC will save the current frame as something like
~/.vlc/vlcsnap-533222343.png. Rename and move this file, remove the video, job done.
Alternatively, one can convert the whole video to the images sequence. To do this, first convert from Theora to AVI:
$ mencoder ~/out.ogg -o out.avi \ -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800
(options do not really matter, one just need to achieve some format
ffmpeg), and then issue the following command:
$ mkdir img $ ffmpeg -qscale 1 -i out.avi -an -r 2 img/frame%05d.png
and all frames of the video will be saved as
-r option, it specifies how many
frames a second are to be saved. I suggest 2 (making a shot every half a second), it should suffice
to find the image needed without creating hundreds of images. If not, try increasing it.
This technique can be sometimes fairly effective in case one needs to make a lot of screenshots of some working application. It takes less time to record and unpack the video, then pick appropriate images from the saved frames, then to make every screenshot separately.
It rocks when one need to capture the items uneasy to schedule (like different floating popups, multilevel menus etc).