
All the good time!
At one point, I was sick:
- Press PrintScreen
- Search for a place to save it.
- Open the service imageshack \ radikal \ habr effect
- Search on the disk, where I saved this screenshot
- Copy the resulting link, and do with it .....
Now I do:
- Press Ctrl + /
- I copy the resulting link and do with it .....
Isn't it better? And you got it too? Then climb under the cut!
And here we have nothing difficult, but first a little history;)
Having wanted to make a user-friendly tool, I honestly downloaded the gnome-utils source code in which gnome-screenshot lies, but realizing that finishing this “miracle” would be much more difficult, more interesting and slower than writing the next command liner, I reached into man curl ... I must say that you should not abuse this script. We do not want to load our service to the ears, so that it starts to slow down, or something else worse? Therefore, we simply take screenshots and do not abuse.
I wrote an implementation for three popular and well-known file hosting sites:
radikal.ruImageShackHabr EffectFor the work of this child, we need the following utilities:
scrot curl xselIn Debian \ Ubuntu, such systems can be installed by the following command:
sudo aptitude install scrot curl xselNext, create a file
sudo touch /usr/sbin/screen.shMaking it executable
sudo chmod + x /usr/sbin/screen.shOpen your favorite editor, and paste the following code:
#! / bin / bash
scrot /tmp/screen.png
curl -F "upload = yes" -F "filename=@/tmp/screen.png" http://www.radikal.ru/action.aspx | grep "input_link_1 \" "| cut -d" \ "" -f4 | tee -ai /var/log/screens.log | xsel -b -i;
tail -n 1 /var/log/screens.log | xargs -I _ google-chrome _;
notify-send "Download screenshot" "The screenshot was loaded successfully" -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000;
curl -F "upload = yes" -F "file=@/tmp/screen.png" -L http://habrastorage.org/storage/habraeffect/05/68/056805cc524b8f502bd06f517fb65059.pngupload.php | grep -e "original-link" | awk -F "\" "'{print $ 10}' | tee -ai /var/log/screens.log | xsel -b -i;
tail -n 1 /var/log/screens.log | xargs -I _ google-chrome _;
notify-send "Download screenshot" "The screenshot was loaded successfully" -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000;
ImageShack for some unknown reason doesn't want to accept such png'shki, so for it we use jpg. Can you tell me?
#! / bin / bash
scrot /tmp/screen.jpg
curl -F "upload = yes" -F "fileupload=@/tmp/screen.jpg" http://www.imageshack.us/upload_api.php | grep "image_html" | awk -F "=" "'{print $ 2}' | cut -d" & "-f1 | tee -ai /var/log/screens.log | xsel -b -i;
tail -n 1 /var/log/screens.log | xargs -I _ google-chrome _;
notify-send "Download screenshot" "The screenshot was loaded successfully" -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000;
Choose for yourself what you want, and leave only
ONE line with curl.
Next, sculpt in the hot keys, in my gnome, you can have it differently, the opening on the buttons of our script.
habrastorage.org/storage/habraeffect/05/68/056805cc524b8f502bd06f517fb65059.pngfiles/1a8/ef227f182/screen.pngHere is an example for a gnome.
Now that's all)
PS I suggest you create something similar for other photohosting. Be sure to include in the article;)
')
UPD0. Added the ability to copy links to the clipboard using xsel