hoangtranwork
7/2/2016 - 6:31 AM

Share screenshots on Ubuntu using Dropbox

Share screenshots on Ubuntu using Dropbox

#!/bin/bash
################
# Description:
# This script will take screenshot of your desktop
# or only active window ( running with -u param ),
# or a rectangle on screen ( running with -s param ),
# copy it to /Dropbox/Screenshots/ with uniq name
# and save path to clipboard
#################
# Requirements: 
# Dropbox
# scrot
# xclip
# notify-send
#################

TSTAMP=`date "+%Y-%m-%d_%H.%M.%S"`
IMAGEPATH="/media/hoang/Data/Dropbox/Screenshots/Screenshot_$TSTAMP.png"

sleep 0.2

scrot $1 $IMAGEPATH
# echo $IMAGEPATH

sleep 0.5

SHORT_URL=$(dropbox sharelink $IMAGEPATH)

echo $SHORT_URL | xclip -selection c

notify-send "Screenshot added" "Screenshot link copied to clipboard: $SHORT_URL"