6

I already know of the Prt Scrn key method of taking a screenshot in Ubuntu. Which when press takes a screenshot and prompts you to save it.

for example:

enter image description here

Is there anyway to have Ubuntu save the screenshot automatically without prompting me to save?

  • 1
    Could you please post the version of Ubuntu that you are using, (E.G. Ubuntu Gnome 16.04) – user689314 Jun 13 '17 at 18:26
  • 1
    What flavour are you using? – user364819 Jun 13 '17 at 18:32
  • 1
    @ParanoidPanda It's the standard flavour of Ubuntu the one from ubuntu.com with the unity desktop environment. – Henry WH Hack v2.1.3 Jun 13 '17 at 18:43
  • 1
    Really? The top bar looks really weird... – user364819 Jun 13 '17 at 19:39
  • 1
    @ParanoidPanda Yes it is. The reason why my top bar looks like that is because I changed it using Unity Tweak Tools. – Henry WH Hack v2.1.3 Jun 13 '17 at 19:52
2

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.

| improve this answer | |
5

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

| improve this answer | |
  • 3
    I've edited that. Actually there were some problems in source which prevents the code to run. It is corrected in my answer. – Hamed Jun 13 '17 at 21:22

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.