Saving screenshots to a different directory in GNOME 3
Gnome environment has a lot of built-in widget and one of the most useful is gnome-screenshot. It takes a screenshot when you hit the Print Screen key on your keyboard and save it to the defaults /Pictures folder.
For me, screenshot savings in that folder is annoying because several times I took images of my desktop for post on social or blogs and, after few seconds, I’ll delete them. In my /Pictures folder, I have many other folders (Not an organized photos and pictures library, just a pure caos!) and all the times I want to delete the screenshot images, this folder takes time to render and I also risk a chance to delete something wrong.
Best solution is moving the screenshots folder to a different directory. In older versions of Gnome, this was accomplished by editing gnome-screenshot’s dconf configuration.
In dconf-editor go to org/gnome/gnome-screenshot and type in your savings folder in the auto-save-directory value. With absolute path, like: /home/user/Downloads
Since Gnome 3.8+ does not use gnome-screenshot and due to Bug 699642, it is useless to change this settings and you need to create a new shortcut to replace the default one.
So, in Gnome Control Center:
And disabled the shortcuts referred to:
- Print - Alt+Print - Shift+Print
To disable a shortcut, select it and use Backspace key.
Then select the Custom Shortcuts tab and make 3 new shortcuts for the same behaviors.
In the command places, put respectively:
sh -c '/home/user/.scripts/ssfull.sh' sh -c '/home/user/.scripts/sswin.sh' sh -c '/home/user/.scripts/ssarea.sh'
In your Home folder at /home/user/, make a new secret directory called .scripts and create 3 script file in it.
#!/bin/bash ##ssfull script DATE=$(date +%Y-%m-%d-%H:%M:%S) gnome-screenshot -f /home/user/Downloads/Screenshot-$DATE.png
#!/bin/bash ##sswin script DATE=$(date +%Y-%m-%d-%H:%M:%S) gnome-screenshot -w -f /home/user/Downloads/Screenshot-$DATE.png
#!/bin/bash ##ssarea script DATE=$(date +%Y-%m-%d-%H:%M:%S) gnome-screenshot -a -f /home/user/Downloads/Screenshot-$DATE.png
Make all scripts executables through:
sudo chmod a+x '/home/user/.scripts/ssfull.sh' sudo chmod a+x '/home/user/.scripts/sswin.sh' sudo chmod a+x '/home/user/.scripts/ssarea.sh'
Now, the Print Screen and the others behaviors point savings to the /Downloads folder or to the folder that you choose.
There is no need to create three (slightly) different scripts actually. You just need to make different shortcuts pass different options to your script, which in turn would pass these extra options to gnome-screenshot. My setup:
mkdir -p $DIR
gnome-screenshot -f $DIR/screenshot-$DATE.png $@
Bindings (expand path to script):
sh -c '~/.local/bin/tmpshot'
[Shift + PrnScr]
sh -c '~/.local/bin/tmpshot --area'
[Alt + PrnScr]
sh -c '~/.local/bin/tmpshot --window'