Take screenshots with gnome-screenshot

Gnome-screenshot is a default tool for making screenshots in GNOME environment. It is a simple and actual utility that provide a large number of settings. We can install it on every distributive on every environment. Gnome-screenshot supports also Wayland protocol, which wants to serve as a replacement for X system. We can set own shortcuts to take screenshot of a desktop, window or area that we select. Gnome-screenshot also has GUI, so if you don’t like use terminal commands, you can easily set parameters (such as screenshot delay, include pointer, include window border) in utility interface.

Install gnome-screenshot

We can install it (on Debian, Ubuntu) by the following command:

sudo apt install gnome-screenshot

Then we can run gnome-screenshot GUI by the following command:

gnome-screenshot -i

Here’s what it looks like on my system:

Gnome-screenshot appearence
Gnome-screenshot user interface

Set shortcuts for gnome-screenshot

First, you need to know which window manager you are using. It can be Openbox (in LXDE environment), Xfwm (XFCE), i3wm, awesome WM, KWIN (KDE), dwm and many others. So, you just need to google how to set shortcuts on your Window manager! I will try to give some examples that I found since I use only dwm!

Shortcuts in GNOME environment

Go to Settings->Devices->Keyboard

Keyboard settings in GNOME
In GNOME environment shortcuts settings can be configured in keyboard panel

Set shortcuts in Openbox (LXDE environment)

First. Follow to *-rc.xml file ~/.config/openbox/*-rc.xml it may have a different names.

Second. Open it and look for </keyboard> tag. This is where the settings for the keys end.

If you want take a screenshot with area selection with Shift+Print Screen combination add follow strings right before </keyboard> tag! Here what it looks like

<keybind key="S-Print">
  <action name="Execute">
    <command>gnome-screenshot -a</command>

The screenshot will be saved to your home directory ~ by default.

Xfwm (XFCE environment)

Open XFCE Menu, then follow Settings -> Keyboard, click on “Application shortcuts”, click “Add” in the command field type: “gnome-screenshot” then click OK and press your combination. Instead of “gnome-screenshot” you can add additional parameters such as -a, -w.

Change screenshot directory for gnome-screenshot

This can be done using special utilities but all of them are suitable for GNOME environment. Let’s follow a universal way that doesn’t require installation of any applications and 100% works. We need to write a script.

Create a file and name it. Assume, we called our file as screenshot-script. Add the following code in it

DATE=$(date +%Y-%m-%d-%H:%M:%S)
gnome-screenshot -a -f ~/Screenshot_Directory/Screenshot-$DATE.png

Don’t forget to change directory path in the third line. So, the file name is based on time, and -a option means select an area, -f means set the file name as …

Make it executable

chmod +x ./screenshot-script

then you can run and check it


Now you can bind that script to any shortcut you want.

Basic options of gnome-screenshot

Make a delay (in seconds) before to take a screenshot:

gnome-screenshot -d 5

This will add a delay of 5 seconds.

Make a delay then grab the current active window:

gnome-screenshot -w -d 3

Select an area (hold your mouse button) and take a screenshot:

gnome-screenshot -a

Include the pointer:

gnome-screenshot -p

Specify the path and filename of the output file:

gnome-screenshot -f /tmp/Image.png

Updated: April 11, 2019 — 10:48 am