Skip to content

Instantly share code, notes, and snippets.

@sanderfoobar
Created January 7, 2017 09:50
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 sanderfoobar/1320abb777029f808110eedfdb305435 to your computer and use it in GitHub Desktop.
Save sanderfoobar/1320abb777029f808110eedfdb305435 to your computer and use it in GitHub Desktop.
Paste screenshot from terminal with scrot, python-requests, libnotify, xclip
#!/bin/bash
# Paste a screenshot taken with `scrot` to https://paste.cedsys.nl. Resulting link will be copied to clipboard.
# requires: python-requests, scrot, xclip, libnotify-bin, libnotify-dev
echo $(scrot -s -e 'printf $f |
python -c "\$\(echo aW1wb3J0IHN5cztpbXBvcnQgcmVxdWVzdHM7YmFzZV91cmkgPSAiaHR0cHM6Ly9wYXN0ZS5jZWRzeXMubmwiO2ZpbGVzID0geyJmaWxlc1tdIjogb3BlbihzeXMuc3RkaW4ucmVhZCgpKX07ciA9IHJlcXVlc3RzLnBvc3QoIiVzL3Bhc3RlIiAlIGJhc2VfdXJpLCBmaWxlcz1maWxlcyk7c3lzLnN0ZG91dC53cml0ZSgiJXMlcy9yYXciICUgKGJhc2VfdXJpLCByLmpzb24oKVsidXJpIl0pKQ==
| base64 -d\)" && mv $f ~/screenshots') |
xclip -selection clipboard &&
notify-send -t 1000 $(echo "Pasted (clipboard)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment