I need a tool that will do the following: selecting a window, will make a screenshot of that window with a x padding, like in the following image:
So, in most of the cases x will be equal with y, but sometimes I need different distances.
How to make such a screenshot, automatically? I tried with Shutter, but I couldn't find such a setting there. However, it supports plugins. So a plugin could be to crop the window this way.
Script, using Shutter
I don't think it exists, but like anything, it can be made.
If you make the script below available under a key combination (explanation further below), a window will pop up, allowing you to set the margins of your screenshot on the left, right, top and bottom, separated by a space:
result:
or:
result:
etc.
I set the default to 30 px, but you can set any default value (see below).
How to use
The script uses
Shutter
andwmctrl
. AssumingShutter
is already on your system (since you mentioned it), installwmctrl
:N.B. If you use Kubuntu,
Zenity
is not installed by default:Copy the script below into an empty file. If you want you can change the "default' marge in the line of the script:
save it as
custom_screenshot.py
.Add the script to a key shortcut combination: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
Note
The script uses
wmctrl
to determine the position of the window. On different window managers however, the output of thewmctrl -lG
command shows small differences in the y-position of the window. These differences are eliminated by the value, set in thedeviation=
-line of the script. The currently set value (0) is appropriate for Unity and KDE.The script is also tested, and works fine on
Xfce
andGnome
, but the value needs to be changed then, as explained in the head section of the script.The script
You can take screenshots with the
scrot
command line screen capture utility:or
The second command puts a border around the selected window, which has a nice width in relation to the size of the window. The
-d 5
option stands for delay and gives you a delay of 5 seconds to select the window to be in the screenshot.Install with this:
Reference: Ubuntu Manual - scrot
You can also use combination of Shift and PrtScr buttons to take screen-shot of a specific area with user-defined dimensions.
Just press the combination and use the modified-cursor ( it becomes similar to a plus sign ) to choose the area for screen-shot.