Syed Humza Shah


Engineering leader. Likes coffee. Loves to travel. Runs on a combination of optimism and pragmatism.

Read more about him here.

How to take screenshot, upload to Dropbox, and get sharing URL in Ubuntu 17.10?

Ubuntu 17.10 ships with Wayland by default. This breaks the default behaviour of many applications which worked fine with Xorg. One of these application is Shutter which people could use to take screenshots and upload to Dropbox (something I do frequently to share screenshots over Slack with team members).

Not wanting to switch to Xorg, I needed a convenient solution to do the following:

The following script helped me do the above, after ensuring I had xclip and Dropbox installed.


function take-area-screenshot-and-upload-to-dropbox {
  local screenshot_file_path="$HOME/Dropbox/Public/Screenshots/screenshot_`date +'%F_%T' | tr : -`.png"
  mkdir -p `dirname $screenshot_file_path`
  gnome-screenshot -a -p -f $screenshot_file_path
  sleep 0.3
  local link=$(dropbox sharelink $screenshot_file_path)
  echo $link | xclip -selection c
  echo "Copied $link to clipboard."
  return 0


I put that in a ~/ file and setup a custom shortcut for it (in Settings -> Keyboard). The shortcut was Ctr + Shift + R and using it executes bash ~/ The cursor changes, I take the screenshot, and paste the sharing link of the file anywhere since it’s already copied to the clipboard.

Additionally, if you’d like to add a border to your screenshots, you can add the following line to your script after the gnome-screenshot command and before the sleep command. You can change the HEX code to match the color of the border you would like.

convert -border 2x2 -bordercolor "#1F30B8" $screenshot_file_path $screenshot_file_path