How can I autosave screenshots in Ubuntu 17.04?

You can do that by installing scrot command-line screenshot tool and setting CompizConfig Settings Manager to use scrot when Prt Scr key is pressed:

  1. Install scrot using the following command in terminal or using software center:

    sudo apt install scrot
    
  2. Open gedit as root by pressing Alt + F2 and running gksu gedit. In gedit paste the following code:

    #!/bin/sh
    mkdir ~/Pictures/Screenshots
    scrot 'Screenshot_%Y-%m-%d_%H-%M-%S.jpg' -e 'mv $f ~/Pictures/Screenshots/'
    

    You can change the way it saves the screenshot by changing the above command. Save the file with the desired filename in /usr/bin/ and close gedit. Let us assume you saved it as scrot-sreenshot for the next steps.

  3. In terminal run the following command:

    sudo chmod 755 /usr/bin/scrot-screenshot
    
  4. Open CompizConfig Settings Manager. If you don't have it installed, please install it first.

  5. Click on Commands and enable that.

  6. In a Command-line field in the Commands tab, enter scrot-screenshot (let us assume you selected Command line 0).

  7. In the Key Bindings tab, in Run Command 0, enable it by clicking on the button which says Disabled -if it was not previously configured- and ticking the checkbox saying Enabled.

  8. Click on Grab Key Combination and press Prt Scr. It will show you a warning saying that the key is already used by Take a Screenshot and let's you to disable it. Disable Take a screnshot and everything should work as you want.

Source


You can do it in a simple way:

  1. Open "CompizConfig Settings Manager". If you don't have it installed, you'll need to install it.

  2. Click on Commands and enable it.

  3. Choose one empty Command line field, e.g. 0, and input: gnome-screenshot -f $HOME/Pictures/"Screenshot from $(date +%Y-%m-%d%t%H-%M-%S)".png

  4. In the Key Bindings tab, in Run Command 0, enable it by clicking on the button which says Disabled -if it was not previously configured- and ticking the checkbox saying Enabled.

  5. Click on Grab Key Combination and press Prt Scr. It may show you a warning saying that the key is already used by Take a Screenshot and allows you to disable it. Disable Take a screnshot and everything should work as you want. If the warning is not shown, open System Settings -> Keyboard -> Shortcuts -> Screenshots and disable or change the shortcut "Take a screenshot".

Basically, no need to install other screenshot software, or deal with scripts. Gnome-screenshot knows how to autosave if you provide the save path. Of course, feel free to choose a different save path or date/time format, in the example I used a similar one to the default. You can also change other options as in grabbing just the current window, etc; you may see the available options in gnome-screenshot --help. This solution works with older versions of Ubuntu as well, e.g. 16.04.