Screenshot tools for Linux

— door Evert Mouw

(This article is meant for intermediate and advanced Linux users.)

To quickly make screenshots, I consider these popular screenshooter tools:

  • xfce4-screenshooter
  • scrot

Because I use XFCE with Arch Linux, I prefer lightweight, fast tools, without loads of dependencies. I also like to autosave screenshots without bothering with questions and user dialog screens. In this blogpost, I will compare a few main features and test the speed of these two utilities. Note that there are many more screenshoters. The screen capture program maim is intended to improve on scrot. While scrot is old, it is fast and gets the job done. Also there is a resurrecting project, which Arch uses. For XFCE users, xfce4-screenshooter is part of xfce4-goodies.

The often recommended shutter tool is less ideal for XFCE as it depends on gnome-vfs in the AUR. The predecessor of shutter was called gscrot and was a perl-based frontend for scrot. It seems shutter still is such a frontend, and has a lot of perl dependencies. I wanted to try it from AUR but got a build error in the libwnck+ dependency, so I gave up because it seems shutter does not satisfy my need for a tool with minimal depedencies for XFCE.

Both tools can grab the whole screen, the active screen (in focus), a custom part of the screen, and save the file. Only xfce4-screenshooter can also copy the screenshot to the clipboard; scrot has no option for that. For scrot, that can be solved by using the --exec option combined with the xclip tool. An advantage of scrot is that it can use modifyers for the output filename; so you can use the date and time and other variables in the filename. An advantage of xfce4-screenshooter is the nice dialog it can show if no options are given on the command line.

Examples

Make a screenshot of the whole full screen.

Make a screenshot of the active windows in focus.

Note: The --border option for scrot is optional; it includes the border drawn by the Windows Manager.

Select and store a custom region (rectangle).

Combined versions: for the active window; copy to clipboard, save to file.

Speed comparison

The last example above, the combined versions, were tested using time. The xfce4-screenshooter took 0.39 seconds on the 2nd run; the scrot version took 0.10 seconds on the second run. (I tested it for the second run to include caching effects. The first match was also won by scrot.) Clearly scrot is the winner for quick, no-dialog scenarios.

My preferred command

Let’s copy the screenshot itself to the clipboard, and the filename to the “primary” buffer“. To learn more about”primary” and “clipboard”, see clipboards-spec and this question. Also scrot’s ability to include variables in the output filename, and it being desktop agnostic, makes it perfect for automated use.

Even better would be to include the window title of the active window, but that would complicate matters as you need to filter out illegal characters and so forth. Still it can be done in a reasonable manner:

To have the full experience, I decided to use a shellscript. See screenshot.sh (click on the link to download).

Keyboard shortcuts

I propose to use the same keyboard shortcuts as the free, open source Greenshot tool for Windows. In addition, I use the Super key (Windows key) to launch a custom dialog.

  • region: PrnScn
  • window: Alt-PrnScn
  • fullscreen: Ctl-PrnScn
  • custom: Super-PrnScn

To keep consistency, I personally set the same keyboard shortcuts in XFCE.

Note that the first line contains a workaround (see also here) for a bug #616608 in scrot.

To see currently assigned PrnSrn keys:

Finally

This works for me. For a discussion on screenshooters, see e.g. on the forum of Linux Mint.

screenshot
Editing screenshot.sh and making a screenshot using that script and scrot.
     

SCHRIJF ALS EERSTE EEN REACTIE

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze website gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.