How to create custom screenshot shortcuts

Unity, Gnome and gnome-screenshot over scrot

I’m really satisfied with the default Gnome screenshot system. Easy to use and very responsive.

Simple press Prt button for a whole screen grab,
just Shift+Prt to catch an area or Alt+Prt to get a window saved.

Easy, fast and reliable.

It’s Gnome Screenshots and screencasts.

But what if you need to customize it?

System settings > Keyboard > Shortcuts and you can change the default behaviors.

Add custom shortcuts to add something new.

Just add the appropriate gnome-screenshot command combination. Not really.

Gnome Custom Screenshot

If you put the command directly in the shortcut window, it doesn’t work.

Apart from that, for my needs, I must leave the original shortcuts available for the use with external keyboard (which has a Prt key) and I must create new shortcuts to use in mobility with the laptop keyboard (which has no Prt key) only.

So… we need to create some simple scripts.

mkdir ~/Pictures/Screenshots/
mkdir ~/.scripts/

cd ~/.scripts/

touch shot.sh shot-area.sh shot-window.sh

nano shot.sh

Edit the scripts and save with CTRL+O.

#!/bin/bash
#
# Custom screenshot key - shot.sh
#

gnome-screenshot  -f "$HOME/Pictures/Screenshots/$(date +%F_%H:%M:%S).png"
#!/bin/bash
#
# Custom screenshot key - shot-area.sh
#

gnome-screenshot -a -f "$HOME/Pictures/Screenshots/$(date +%F_%H:%M:%S).png"
#!/bin/bash
#
# Custom screenshot key - shot-window.sh
#

gnome-screenshot -w -f "$HOME/Pictures/Screenshots/$(date +%F_%H:%M:%S).png"

Make the scripts executable:

chmod +x shot.sh
chmod +x shot-area.sh
chmod +x shot-window.sh

And finally set the shortcuts in the keyboard settings with the complete path:

CTRL+SHIFT+S  ---> /home/user-name/.scripts/shot.sh
CTRL+SHIFT+A  ---> /home/user-name/.scripts/shot-area.sh
CTRL+SHIFT+W  ---> /home/user-name/.scripts/shot-window.sh

That’s all.

Leave a Reply

Your email address will not be published. Required fields are marked *