fruitcombo

go back

originally i had been using ksnip from KDE which is a very nice tool but the gui popping up for a brief instant when using the command line version was annoying me (that is literally the entire reason for all this). i use xfce, so i resolved to use its default screenshot tool even if there were some things about it that annoyed me. these included:

other than those it's a good program. here's my solutions.

capturing multiple monitors individually with xfce4-screenshooter

for two monitors, it's a case of making however many copies of the screenshot as you have monitors and cropping them each accordingly. this requires having gimp installed to find the coordinates, and imagemagick installed to be able to use its mogrify command's cropping ability.

to find out where to crop, open a screenshot in gimp and use the Rectangle Select tool. in the Tool Options docker, it will display the width and height under Size and X Y coordinates under Position, which need to be formatted as widthxheight+X+Y for the mogrify command. (this guide was very helpful!)

you can download this script here as a template.

#! /bin/bash
# notification sound (as opposed to send-notify which visually obscures part of the screen)
play --volume 0.5 -q /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
# make timestamp to use as filenames
timestamp=$(date +%Y-%m-%d--%H-%M-%S)
# take screenshot
xfce4-screenshooter --fullscreen --save $HOME/Pictures/screenshots/$timestamp.png
# make a copy for second monitor
cp $HOME/Pictures/screenshots/$timestamp.png $HOME/Pictures/screenshots/$timestamp-2.png
# crop first screenshot to main monitor
mogrify -crop 1680x1050+1200+766 -colorspace sRGB $HOME/Pictures/screenshots/$timestamp.png
# crop second screenshot to second monitor
mogrify -crop 1200x1920+0+0 -colorspace sRGB $HOME/Pictures/screenshots/$timestamp-2.png

to execute this easily, assign it to a keyboard shortcut (i use just the printscreen key).

capturing a single monitor

i find that often i only need to capture the main monitor and deleting the second monitor capture annoys me, so i made a simple tweak and assigned it ctrl + printscreen. you can download it here. it should be trivial to make more individual scripts and keybindings for each additional monitor.

#! /bin/bash
# notification sound (as opposed to send-notify which visually obscures part of the screen)
play --volume 0.5 -q /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
# make timestamp to use as filename
timestamp=$(date +%Y-%m-%d--%H-%M-%S)
# take screenshot
xfce4-screenshooter --fullscreen --save $HOME/Pictures/screenshots/$timestamp.png
# crop screenshot to main monitor
mogrify -crop 1680x1050+1200+766 -colorspace sRGB $HOME/Pictures/screenshots/$timestamp.png

snipping tool

and of course sometimes you need even less than that. as opposed to a keybinding, this one is a launcher on my xfce panel since i have to use the mouse to select a region anyway. download it here.

#! /bin/bash
# make timestamp to use as filename
timestamp=$(date +%Y-%m-%d--%H-%M-%S)
# take screenshot
xfce4-screenshooter --clipboard --region --save $HOME/Pictures/screenshots/$timestamp.png
# xfce-ss's clipboard functionality is unreliable, so this uses xclip instead (xfce-ss also automatically saves a copy to /tmp/Screenshot_(date-time).png if the save flag isn't used, but since the above command does use the save flag, we'll just use that one)
xclip -selection clipboard -t image/png -i $HOME/Pictures/screenshots/$timestamp.png
# notification sound (at the end as you have to select a region first)
play --volume 0.5 -q /usr/share/sounds/freedesktop/stereo/camera-shutter.oga