

Sitting at home on a quiet Sunday evening, I suddenly realized that I really lacked a quick removal and upload of screenshots in Linux. There are a lot of ready-made solutions, but all of them for one reason or another did not suit me, as a rule, all ready-made solutions required too many clicks. I picked up a file and spent 30 minutes of my time making a really convenient way to upload screenshots to habreffect.ru
To download on habreffect.ru we need:')
- Fixed compiz, compizconfig-settings-manager and compiz-plugins
- Installed curl, xsel, libnotify-bin packages
- Straight arms
For lazy ubuntovodov
sudo apt-get install compiz compizconfig-settings-manager compiz-plugins curl xsel libnotify-bin
To upload to Dropbox we need:- Fixed xsel and libnotify-bin, compiz compizconfigconfig-settings-manager compiz-plugins
For lazy ubuntovodov
sudo apt-get install xsel libnotify-bin compiz compizconfigconfig-settings-manager compiz-plugins
All of the above packages are in turnips.
For the basis, I took the script from angel2s2
habrauser for which he had the honor, praise and advantages in karma.
The original script can be viewed
here .
1. Create a shell script with any name, and in any directory.
For the purposes of this manual, it will habreffect.sh and be in the directory /home/vitali/.bin
We copy there the following contents.
#!/bin/bash
trap "_exit" INT KILL TERM QUIT
_exit() {
rm -f $SCREEN_FILE
exit
}
LOG_FILE='/var/log/screenshots.log'
SCREEN_FILE='/tmp/screenshot1.png'
LOG_STR=$( curl -s -F "upload=yes" -F "file=@$SCREEN_FILE" -L habreffect.ru/upload.php |\
sed -ne '/\ \|delete:/s/^.*\(http.\+\)".*$/\1/gp' | tr '\n' ' ' |\
sed -e "s/'\ $/\ \]\n/;s/[\ \t]/\t\[del: /;s/^/$(date '+%d.%m.%Y %H:%M')\t/" |\
tee -ai $LOG_FILE | awk '{print $3}' )
[ $? -ne 0 ] && FINISH="[ FAIL ]"
echo $LOG_STR | xsel -b -i
notify-send -t 5000 -i dialog-information " "
_exit
For Dropbox
#!/bin/sh
DPDIR=~/Dropbox/Public
ID=ID
if [ -e "$1" ]
then
cp -f "$1" "$DPDIR"
file=`basename "$1"`
link="http://dl.getdropbox.com/u/$ID/$file"
notify-send -i go-down "Dropbox" " "
echo "$link" | xsel -b -i
else
notify-send -i dialog-information "Dropbox" " !"
fi
Making the script executable
chmod +x /home/vitali/.bin/dropbox.sh
If you use the script for Dropbox, go to step 3
In short, this script takes a file named /tmp/screenshot1.png (about it a little later), loads it with curl on habreffect.ru, copies the resulting link with xsel and displays a notification on the screen using libnotify-bin, cleans up and leaves the date, a link to the screenshot and a link to delete it in the log /var/log/screenshot.log
2. Before use, you must create the file /var/log/screenshots.log and give it rights to write.
sudo touch /var/log/screenshots.log && sudo chmod 666 /var/log/screenshots.log
But the shell script itself must be given permissions to execute.
chmod +x /home/vitali/.bin/habreffect.sh
I hope you will guess your path.3. Go directly to the plugin from Compiz. Further, I assume that you already have Screenshot plugin. It should have been bundled with the compiz-plugins package.
- Launch Compiz Settings Manager either via the menu or by pressing ALT + F2 -> ccsm.
- We search in the Screenshot list, turn it on and open it.
- In the Directory column we write / tmp, in the Launch application column, the path to our skipt.
After our manipulations, it should look something like this.

Done! Now all we need to do is to hold down the hotkey set by you (By default Super + Left click) and make a stroke of that zone, the screenshot of which we want to do.
Unfortunately, I found one drawback with this method, with the selection of the full screen, the screenshot still has a blue selection background. I did not find solutions to this issue. this is the problem of the compiz plugin
Alternatively, you can use the original script from
angel2s2 , it makes a full screenshot of the desktop.
Another drawback of the script is that it will only take a screenshot from the name of screenshot1.png, this is again a restriction of the plug-in and I cannot do anything about it. This does not concern the end user as long as there are no other files in the folder with the screenshot1.png name, the script cleans up each time, so you should not worry about it. The script for Dropbox does not suffer from this disadvantage.
Any comments and corrections are welcome.
For mortals without compizThe author of the script for Dropbox is
oWeRQThe script has been updated due to the update of the image loading process habreffect.ru