5

I just freshly installed Ubuntu 18.04 and downloaded the latest updates. I'm having trouble taking screenshots to clipboard using the built-in gnome-screenshot tool. The default keyboard shortcuts Ctrl+PrintScreen and Ctrl+Shift+PrintScreen don't appear to work (makes the shutter sound, but empty clipboard and nothing saved in Pictures folder either), and using gnome-screenshot -c in the terminal is similarly ineffective.

I've read that gnome-screenshot had clipboard issues with Wayland, but my understanding is that 18.04 defaults to Xorg. Checking my login settings, the default is "Ubuntu," with a secondary "Ubuntu on Wayland" option. I'm just using the default.

2
  • Ubuntu 18.04 use Xorg by default – Jerare Dec 17 '19 at 20:52
  • Just to make sure, run echo $XDG_SESSION_TYPE to check your session. – pomsky Dec 19 '19 at 14:17
4

Not sure if this is related - in my case (fresh Ubuntu 19.10), gnome-screenshot -c would put the captured image to the clipboard, but somehow I can only paste it in certain applications (e.g. Gimp) while not in others (e.g. Chrome).

Found a workaround by (assigning to a shortcut) this:

gnome-screenshot -acf /tmp/test && cat /tmp/test | xclip -i -selection clipboard -target image/png
2
  • Nice workaround. Mine was working fine with Ubuntu 18.04 and when I recently upgraded to 20.04 it stopped working. Thanks for this solution. – raddevus Oct 8 '20 at 15:17
  • 1
    To make this work with Ubuntu 20.04 Keyboard Shortcuts I had to wrap it sh -c "gnome-screenshot -acf /tmp/test && cat /tmp/test | xclip -i -selection clipboard -target image/png" – Brian Leishman Apr 12 at 16:01
4

Had the same problem in Ubuntu 20.04: gnome-screenshot -a -c was not copying to clipboard.

Solution was to ensure xclip was installed with sudo apt install xclip.

  • gnome-screenshot version = 3.36.0
  • xclip version = 0.13-1
1
  • This is the correct solution! – Ikbel Jun 6 at 14:46
1

Today I had a similar problem under Oracle Linux 8: It wouldn't copy to the clipboard. I could resolve this with running the command:

env GDK_BACKEND=x11 gnome-screenshot -i

Note the x, it is not capital X as usual!

You may enter -c instead of -i, of course. On this Oracle Linux 8 machine other applications couldn't create a window at all without the GDK_BACKEND setting.

1
  • How do you run this though? – mathtick Dec 30 '20 at 18:48
0

Try find $HOME -name "Screenshot*" to see if the screenshots are being saved in an unexpected location. Also check Settings|Keyboard Shortcuts. In a recently upgraded 20.04.1 (from 18.04) gnome-screenshot saved the png images in $HOME instead $HOME/Pictures as before.

0

I had this problem on Ubuntu 20.04 but I couldn't get it working from a custom shortcut key. I had to write a bash script.

Note: I also had to install xclip as shown in Ben's answer.

Here it is:

  1. nano screengrab.sh
  2. add text shown below
  3. save file
  4. chmod a+x screengrab.sh (make it executable script)
  5. open shortcut keys and add details shown in image below

screengrab.sh contents

rm -rf /home/user/Pictures/2.png

gnome-screenshot -acf /home/user/Pictures/2.png

Note: Your PNG file can be named anything, just make sure you delete the same named file first and then it will be created each time by the gnome-screenshot app. If you don't delete it or you have the wrong file name each time it will fail silently.

shortcut keys

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.