A short script to upload screenshots to an SFTP server
Project description
Challenged by the ease of use of existing tools to capture and upload screenshots so that they are available for the general public, this script was made.
The only required dependencies are scp and scrot. Optional dependencies are:
optipng (used by default, can be turned off in configuration)
xclip (to save URLs to clipboard or to capture PNG images from clipboard)
zenity (to display URLs in a window)
Configuration
The upload URL is configured using a config file dont-puush-me.ini. It can be placed anywhere in your XDG configuration paths (usually ~/.config and /etc/xdg).
The config file has the following format:
[upload] scp_format=user@host:/path/to/directory/{}.png url_format=https://host.example/directory/{}.png [process] optipng=true
The scp_format and url_format settings are required and no default exists for them. In those, the first occurence of {} is replaced with the automatically generated filename for the image. You need to set those values such that scp can be used to upload the file so that it will be reachable at the url given by url_format afterwards.
The optipng setting is a boolean setting which enables or disables the default use of optipng before uploading an image.
Usage
The usage is simple:
usage: dont-puush-me [-h] (-f | -r | -c) [-d SECONDS] [--no-optipng | --optipng] [--save-locally FILE] [-z] [-p] [-s] [-b] Use scrot to create a screenshot which is either saved locally or uploaded to a hardcoded server. optional arguments: -h, --help show this help message and exit Capture settings: -f, --fullscreen Make a shot of the entire screen -r, -w, --select Select a region or window to screenshot -c, --from-clipboard Use the image from the clipboard -d SECONDS, --delay SECONDS Delay the screenshot by the given amount of seconds Image processing: --no-optipng Disable use of optipng before uploading (overrides config option) --optipng Enable use of optipng before uploading (overrides config option) Upload settings: --save-locally FILE Save the file locally instead of uploading it to a server URL output settings: -z, --zenity Show the URL using zenity -p, --to-primary Save the URL in the primary X11 selection. -s, --to-secondary Save the URL in the secondary X11 selection. -b, --to-clipboard Save the URL in the clipboard X11 selection.
Examples:
Capture a fullscreen screenshot and copy the resulting URL to the primary X11 selection:
dont-puush-me -fp
Capture a rectangle from the screen (the rectangle is picked using the mouse; clicking without dragging selects the rectangle of the clicked window):
dont-puush-me -r
Capture a rectangle, do not apply optipng and display the URL in a window (requires zenity):
dont-puush-me --no-optipng -rz