Skip to content

Instantly share code, notes, and snippets.

@mervick
Forked from Unibozu/README.md
Created September 8, 2021 06:31
Show Gist options
  • Save mervick/7c422c013f345a5b733bacdc3fc2bdc2 to your computer and use it in GitHub Desktop.
Save mervick/7c422c013f345a5b733bacdc3fc2bdc2 to your computer and use it in GitHub Desktop.
Shutter - Linux - dropbox automatic screenshot url to clipboard

Shutter - Dropbox automatic screenshot URL to Clipboard

Installation

  1. Configure shutter to save your screenshot directly intoyour dropbox public folder.
  2. Place dropbox-puburl.sh in the location of your choice (here ~/tools/bin/dropbox-puburl.sh)
  3. Place dropbox-screenshot-puburl.desktop into /usr/share/applications (you need to be root)
  4. Eventually update the path to your Bash script
  5. exec sudo update-desktop-database
  6. Quit and restart shutter. Go into Preferences > Actions > Open With and select Dropbox copy public file URL to clipboard
  7. Take a screenshot, a notification should appear with the public url saved in your clipboard

Notes

The desktop application will be visible when you right click any JPEG or PNG files, and will also appear in your application drawer. This is required because shutter can only execute an automated application with the right mimetype.

It is not very user-friendly if there is an error. Try to execute the bash script manually by providing the location to one of your Dropbox public files.

#!/bin/bash
NOTIFY=notify-send
SRCURL=$1 # ex: file://xxx
FILE=${SRCURL//file:\/\//}
# Getting public url from dropbox
URL=`dropbox puburl "$FILE"`
# Pasting it into the clipboard
echo "$URL" | xclip -sel clip
$NOTIFY "Dropbox public file URL copied into your clipboard: $URL"
#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
# Terminal=true doesn't work with xclip (not sure why)
Terminal=false
Exec=sh -c '$HOME/tools/bin/dropbox-puburl.sh %u'
Name=Dropbox copy public file URL to clipboard
MimeType=image/png;image/jpeg
Icon=dropbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment