Skip to content

Instantly share code, notes, and snippets.

@busla
Created August 30, 2020 12:40
Show Gist options
  • Save busla/776d6162eeaae8d50f18b9b1699011e3 to your computer and use it in GitHub Desktop.
Save busla/776d6162eeaae8d50f18b9b1699011e3 to your computer and use it in GitHub Desktop.
Dropbox shared url from gnome screenshots
[Unit]
Description = Monitors ~/Pictures dir, copies new files to ~/Dropbox/Screenshots and creats a shared url
[Service]
User=<your-$USER>
ExecStart=/usr/local/bin/make_dropbox_url.sh
[Install]
WantedBy=multi-user.target
#!/bin/bash
PICTURES=$HOME/Pictures/
DROPBOX=$HOME/Dropbox/Screenshots/
export DISPLAY=:0
inotifywait -m -e create -e moved_to --format "%f" $PICTURES \
| while read FILENAME
do
echo Detected $FILENAME, moving to $DROPBOX/$FILENAME
mv "$PICTURES/$FILENAME" "$DROPBOX/$FILENAME"
SHARED_URL=$(dropbox sharelink "$DROPBOX/$FILENAME")
echo $SHARED_URL | xclip -sel clip
echo added $SHARED_URL to clipboard
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment