Gyazo alternative using Dropbox and Compiz - how to
3 replies, posted
There have been scripts going around that use imagemagick to make a screenshot and then upload it to gyazo. The script I used decided to break so I mocked up a simple script that uses Dropbox and its public folder feature.
I am a beginner at making scripts like this so this is [i]extremely[/i] simple, using the compiz screenshot function and Dropbox to do all the hard work. I am aware of the fact that most people could figure this out for themselves in a minute. However, for beginners I made this easy step-by-step guide.
[b]Requirements:[/b]
Dropbox
CompizConfig settings manager (and probably compiz itself, if you have Ubuntu or a derivative with the default stuff you should be set)
In the CompizConfig settings manager you should find this:
[img]http://dl.dropbox.com/u/3661921/screencaps/screenshot7.png[/img]
Click the Screenshot plugin. The default binding is SUPER+mouse1 which is nice but you can change it to whatever.
Create a directory called [b]screencaps[/b] in your Dropbox/Public directory.
Enter the following paths pointing to the directory you just made and the script (we'll make this later)
It will not accept ~ for home, you must enter the real path.
(for example: /home/thefoxz/Dropbox/Public/screencaps/)
Directory: /home/<user>/Dropbox/Public/screencaps/
Launch Application: /home/<user>/screencaps.sh
In my case it looks like this
[img]http://dl.dropbox.com/u/3661921/screencaps/screenshot12.png[/img]
Now make a file in your home directory called screencaps.sh, and paste this:
[code]
#!/bin/bash
#PUT YOUR DROPBOX ID HERE:
dbid=IDGOESHERE
sleep 2;
firefox $(printf http://dl.dropbox.com/u/$dbid/screencaps/
ls -t1 ~/Dropbox/Public/screencaps | head -n1);
exit 1;
[/code]
First of all, replace "firefox" with your browser of choice, if you want to. (for example: chromium-browser). Now you must find out what your Dropbox ID is. Go to your Public folder right click a file to copy the public link. The number will be in there, after the /u/. Put it in front of dbid=
It should look something like dbid=1234567
Save it, and make executable. (In a terminal, type: [b]chmod +x ~/screencaps.sh[/b]
Quick explanation of how the script works: It prints the first part of the url and then finds the latest modified file in your screencaps directory. Since the printf command does not add a newline like echo does, the filename is added to the end of the url. This is then forwarded as an argument to your browser, which proceeds by opening a new tab with the url.
That should be all! Hold super and drag a box. If you get a 404 page, refresh after a couple of seconds. If this happens a lot, increase the sleep value in the script.
Happy screencapping!
If you add a 'sleep 2' or something to wait two seconds, it means you skip the '404' crap because it's already registered on the server. :v:
Modded it for you.
[CODE]#!/bin/bash
#PUT YOUR DROPBOX ID HERE:
dbid=IDGOESHERE
sleep 2;
firefox $(printf http://dl.dropbox.com/u/$dbid/screencaps/
ls -t1 ~/Dropbox/Public/screencaps | head -n1);
exit 1;[/CODE]
And for Chrome...
[CODE]#!/bin/bash
#PUT YOUR DROPBOX ID HERE:
dbid=IDGOESHERE
sleep 2;
google-chrome $(printf http://dl.dropbox.com/u/$dbid/screencaps/
ls -t1 ~/Dropbox/Public/screencaps | head -n1);
exit 1;[/CODE]
And Chromium...
[CODE]#!/bin/bash
#PUT YOUR DROPBOX ID HERE:
dbid=IDGOESHERE
sleep 2;
chromium-browser $(printf http://dl.dropbox.com/u/$dbid/screencaps/
ls -t1 ~/Dropbox/Public/screencaps | head -n1);
exit 1;[/CODE]
Thanks! Nice improvement.
But what's the difference between exit 1 and exit?
None really. I generally use 'exit 1' for successful termination and 'exit 0' for errors. Theoretically it would return 'true' or 'false' if you were executing a string of commands (command1 && command2) or something, but don't quote me on that.
Sorry, you need to Log In to post a reply to this thread.