How can I assign a keyboard shortcut to the function "screenshot" in GIMP

Following preference -> configure keyboard shortcut I cannot find "screenshot in the list of actions".

enter image description here

Ideally, a shortcut for the button "snap" of "shortcut" function

enter image description here

Any hint

  • 1
    Would taking a screenshot with another program if opened in GIMP afterwards qualify as an answer?
    – Smile4ever
    Jan 7 '16 at 8:37
  • Thanks Smile4ever. Well, yes it is a nice workaround, but still the same issue with the screenshot I am using (Shutter) doesn't provide shortcut. I hope GIMP is not so inflexible.
    – AJN
    Jan 7 '16 at 10:19
  • Under most linux window managers, you can add a screenshot of a window to the clipboard with Ctrl+Shift+PrintScreen (or Ctrl+PrintScreen for the whole screen), after that you can switch to gimp, and create a new document from the screenshot with Ctrl+Shift+V. This is a configurationless alternative solution to the problem. Apr 25 '18 at 19:15
  • Under KDE you can start spectacle with just PrintScreen.
    – xenoid
    Jul 24 '18 at 17:31

Today I found a way to open the interactive screeenshot tool from the cli.

gimp --batch '(plug-in-screenshot RUN-INTERACTIVE FALSE 0 0 0 0 0)' --new-instance

If you want to understand this look at https://www.gimp.org/tutorials/Basic_Batch/ to understand the basic syntax. To lookup specific commands navigate to Help > Procedure Browser and search for screenshot.

This will start a new gimp process and open the screenshot dialogue.

I tried to understand the RUN-NONINTERACTIVE flag, but the image never appeared in gimp. So if you really want a shortcut for the Snap button, its probably faster to use something like this:

xdotool mousemove --window `xdotool getwindowfocus` \
          $(xwininfo -id `xdotool getwindowfocus` \
          | sed -n -e "s/^ \+Width: \+\([0-9]\+\).*/\1/p" \
                   -e "s/^ \+Height: \+\([0-9]\+\).*/\1/p" \
          | awk '{print $1-20}' | tr '\n' ' ') \
          click 1

This finds the bottom right corner of the active window and moves your mouse 20 pixels left and 20 pixels up from that point and presses your left mouse button.

  • 1
    OP wants to assign a keyboard shortcut to take a screenshot. But your answer has no mention of the same Dec 28 '19 at 13:18
  • Oh Maybe I forgot to metion this, but if you have the command you can easily assign a keyboard shortcut to it, just like the other answer propsoed
    – Lamaun
    Dec 29 '19 at 14:11
  • And in my opinion, assigning the shortcuts like this will also solve OPs comment under the accepted answer because it also works when GIMP doesn't have focus. @TejasLotlikar would you like me to add the steps to make a shortcut for this?
    – Lamaun
    Dec 29 '19 at 14:20
  • The batch command does exactly what I was looking for. Assigning it to a global hotkey depends on your desktop environment and is usually straightforward (for advanced users at least).
    – Murphy
    Mar 9 '20 at 19:02

Standard shortcut in Ubuntu

You can press Shift+PrtScr to make a screenshot of a region.

Assigning a shortcut to Shutter

  1. In Unity, go the dash (search field) and search for "Keyboard". Click it.
  2. Now click "Shortcuts" (or hotkeys)
  3. At the left bottom, you see "Custom shortcut". Click it.
  4. Now click the add sign button, a bit to your right.
  5. Fill in the name "Screenshot with Shutter" and the command "shutter -s". Confirm.
  6. Now click "Disabled" and press PrtScr on your keyboard.

Making a screenshot of a region from within GIMP (does not work if GIMP is not open)

  1. Under Edit -> Shortcuts you can see a category "Plug-ins". Open it.
  2. Scroll down until you find "Screenshot.."
  3. Click on disabled and assign a shortcut.

Making a screenshot of a region, opening with GIMP afterwards

  1. Save the below script to your home directory as screenshot.sh.

(screenshot is saved in home directory, to save in pictures add "cd ~/Pictures" to the top of the script, just below the first line)

TIMENOW=`date +%T` #results in 10:23:38
DATENOW=`date +%d` #results in 09 (day of the month)
shutter -s -o=$FILENAME
sleep 7 #you have seven seconds to take a screenshot, after that shutter is closed and we try to open gimp
pkill shutter
  1. Now follow the steps above to assign a custom shortcut to the script. The command is now "bash screenshot.sh"
  • 1
    Thanks Smile4ever, Nice answer. I go for the shortcut from GIMP Plug-in. Though it works only when GIMP window is active, it is the closest to what I need.
    – AJN
    Jan 10 '16 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.