CloudApp and Droplr let me take a screenshot or a video of the screen, and insta-upload it to the cloud. How can we replicate that behavior?
First we need something to actually take the screenshots.
-
macOS can use buil-in tools:
- Use Cmd + Shift + 4 for partial screenshot
- Use Cmd + Shift + 3 for full screenshot
- Configure a custom screenshot save location
-
*nix can use 3rd party:
-
Windows 10 can use built-in shortcuts:
- Win + Print Screen for a full screenshot
- See this WikiHow for more options
Ultimately we want a way to watch the screenshots folder for changes, then call s3-upload
with the changed file paths.
For a great cross-platform filesystem watcher, try fswatch. You can try a command like this on start-up:
fswatch --event=Created --event=Updated "$HOME/screenshots" | s3-upload --stdin
You can specify one or more event types to watch:
NoOp
PlatformSpecific
Created
Updated
Removed
Renamed
OwnerModified
AttributeModified
MovedFrom
MovedTo
IsFile
IsDir
IsSymLink
Link
Overflow
On Linux you can use incron to automatically respond to filesystem changes with arbitrary commands.
After installing incrond
, add this code into /var/spool/incron/s3-upload
:
/path/to/screenshots IN_CLOSE_WRITE s3-upload -CN $@/$#
Make sure your user owns the file:
chown "$(whoami)" /var/spool/incron/s3-upload
Check out the guide on annotating screenshots.