Skip to content

Instantly share code, notes, and snippets.

@jirwin
Created August 19, 2018 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jirwin/71bd319be1ca5e8c51176fb2dbc29264 to your computer and use it in GitHub Desktop.
Save jirwin/71bd319be1ca5e8c51176fb2dbc29264 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Create a temporary file to store the screenshot in
tmpfile=$(mktemp /tmp/XXXXXXX.png)
# Take the screenshot
scrot -s "$tmpfile" > /dev/null
# Copy the file to the server
scp "$tmpfile" gina:/mnt/khaldrobo/screenshots > /dev/null
# Generate the url for the screenshot
url=https://s.jirwin.xyz/$(basename "$tmpfile")
# Output url, open the url in the browser, and copy url to clipboard
echo "$url" | xclip
xdg-open "$url" &> /dev/null
echo "$url"
# Remove the screenshot
rm "$tmpfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment