Is it possible to make gnome-screenshot save the image automatically without showing the confirmation dialog window?
I make a lot of screenshots and it would be convenient if I did not have to confirm at every occasion.
You can use the following command in the terminal:
gnome-screenshot -p -w -d 10 -f ~/Desktop/Screenshots/$(date +%Y%m%d%H%M%S).png
man gnome-screenshot
tells us that
-p
includes the mouse pointer-w
limits the region to the active window-d
is used to add a time delay (in seconds) and that's useful if you want to capture stuff like drop-down menus.-f
specifies the path and filename. I've provided a filename that incorporates a "time-stamp".Note: if you want to select a particular area, use -a
(for area):
gnome-screenshot -a -f ~/Desktop/Screenshots/$(date +%Y%m%d%H%M%S).png
The cursor changes to cross-hairs. Drag diagonally across the desired area. You can't use -d
when using -a
.
You can also make a keyboard shortcut so that you don't need to open a terminal each time. To do so, first make a small script using a plain text editor. The contents of the script are:
#! /usr/bin/env bash
gnome-screenshot -a -f ~/Desktop/Screenshots/$(date +%Y%m%d%H%M%S).png
Save the file as a plain text file with an informative name such as my-gnome-screenshot and put the file in ~/bin
. If you don't have such a folder, create one.
Then, using your file manager, right-click on the file, choose properties
and set the file to be executable by owner. If you're comfortable with the terminal, just run chmod +x ~/bin/my-gnome-screenshot
.
Now, use your desktop environment's keyboard shortcut editor/creator to assign a keyboard shortcut to your script.
Then, each time you want to take a screenshot, just press the relevant keyboard shortcut.
Depending on your desktop environment, creating a script may not be needed. In Openbox
which is the default window manager of Lubuntu, one can simply edit the rc.xml
(or lubuntu-rc.xml
) file to contain this keybind (or whatever is suitable and available):
<keybind key="W-4"> # gnome-screenshot of selected ares
<action name="Execute">
<command>sh -c 'gnome-screenshot -p -a -f ~/Desktop/Screenshots/$(date +%Y%m%d%H%M%S).png'</command>
</action>
</keybind>
If you wish to create a .desktop
file for launching the script instead of using the terminal or a keyboard shortcut, the procedure is similar to what is described in the answer to Timestamp in Exec= line of .desktop file possible?.