60

I am trying to configure the 22.04 (Gnome 42) keyboard shortcut to get the "old" functionality of taking screenshots of area selections and pasting them into clipboard (Ctrl + Shft + PrtScr + select/release: done). The problem is that $ gnome-screenshot -ac doesn't copy the selection into clipboard unless there is an instance of gnome-screenshot utility running. Does anyone know how to work around this issue? (I know it is possible to run the "new" interactive screenshot tool, but that takes too many clicks and is not what I want.)

Edit: The issue has been fixed: gnome-screenshot -ac works as intended in Gnome 43.4 or perhaps even in the earlier versions.

8
  • 3
    Just use the print button PrtScrn see here
    – Paul
    Jun 8, 2022 at 11:14
  • 7
    @Paul As mentioned in the question, this is not the functionality that I wanted, as it takes too many clicks to achieve the desired effect
    – Iiro Ullin
    Jun 8, 2022 at 15:41
  • @Iiro_Ullin It takes one click more than previously
    – Paul
    Jun 8, 2022 at 16:15
  • 2
    @Paul Yes and that is already too much. Yet it becomes worse, if the "new" and the "old" selections overlap: then you must move the old selection before you can make the new selection. Anyways, my clicking preferences are not a matter of discussion here: the discussion is about how to fix/work around the clipboard bug in gnome-screenshot
    – Iiro Ullin
    Jun 8, 2022 at 16:40
  • @IiroUllin I ended adding gnome-screenshot -i to startup applications
    – eldos
    Oct 3, 2022 at 6:00

7 Answers 7

43

After installing Ubuntu 22.04

after you log out or restart the computer, the old gnome-screenshot is removed, so you need to reinstall it to make the old command to work.

sudo apt install gnome-screenshot

Add a Custom ShortCuts

Settings → keyboard → keyboard shortcuts → custom shortcuts

Custom shortcuts are at the end of list

gnome-screenshot -c -a

I'm using Shift + Ctlr + Delete shortcut so that it doesn't interfere with the new 42 screenshot shortcuts."

enter image description here

In gnome 42 the default shortcuts for using the screenshots are:
  1. Shift+Print takes a screenshot
  2. Print take a screenshot interactively
  3. Alt+Print take a screenshot of a window
  4. Shift+Ctrl+Alt+R record a screencast interactively

When you press ALT+PRINT throws a message

you can paste the image from the clipboard

To change keyboard shortcuts in GUI:

Settings -> keyboard -> keyboard shortcuts -> Screenshots.

3
  • 14
    Well, that was exactly my point: this doesn't work for me. When you press the shortcut key combo, it makes the sound and all that, but doesn't actually copy anything into clipboard (unless there is an instance of gnome-screenshot already running). Did you verify that it actually works, not just makes a sound?
    – Iiro Ullin
    May 8, 2022 at 21:14
  • 3
    Same issue. I followed you, but it doesn't make anything rather than just making a sound. Did it work for all the guys who upvoted? Your response would be a great help.
    – Vam
    Jul 4, 2022 at 17:35
  • Same, using the custom command from the comment below worked for me: askubuntu.com/a/1458667/993724
    – Stevman
    Jun 7, 2023 at 16:26
19

So this is what I did on my Ubuntu 22.04

Note this is for capturing an area onto the clipboard.

Install Gnome Screenshot: sudo apt install gnome-screenshot

Make sure that Xclip is installed. To install :

sudo apt install xclip

Create a custom keyboard shortcut. I used Ctrl + shift + Print Screen with the following command: sh -c "gnome-screenshot -acf /tmp/test && cat /tmp/test | xclip -i -selection clipboard -target image/png".

7
  • This one worked for me. There is a dot inside the code block that is not part of the command
    – tiriana
    Sep 1, 2022 at 0:26
  • 1
    @tiriana I moved the period out of the code block. Oct 5, 2022 at 17:17
  • I also did this :) Nov 25, 2022 at 8:45
  • wow, this saved my workflow!
    – Ufos
    Dec 4, 2022 at 15:05
  • can you explain, why do we need sh -c "..." the whole command?
    – Ufos
    Dec 4, 2022 at 15:08
10

The -c command to copy the screenshot to the clipboard has a weird bug that doesn't copy the image when using -a to grab a selection.

A way to fix this is to make the command save the screenshot by adding --file={/filepath/filename.png} after the -a -c.

The command all together is gnome-screenshot -a -c --file={/filepath/filename.png}.

I don't know why this fixes the bug but it definitely works so you can try that.

Hope this is what you wanted @Iiro Ullin. Good luck!

9
  • Are you sure it's not copying the image? when I set the command to be gnome-screenshot -a -c --file=/home/betzalel-maor/Desktop/Screenshot001.png I can paste the screenshot! In my answer I wrote -c before -a, so change it to -a -c and it should work. Hope that helped and good luck! May 21, 2022 at 19:01
  • -c -a or -a -c or -ac etc, makes no difference -- it all does the same thing, however saving to a file does indeed fix the clipboard issue and can be used as a workaround. There's some clipboard bug that's been around for years and it seems to persist in this iteration of Gnome as well. I'll accept your answer if you reformulate it a bit to emphasize that that saving to a file somehow fixes the clipboard bug.
    – Iiro Ullin
    May 21, 2022 at 23:04
  • 5
    Sadly this solution didn't seem to reliably work for me, but it gave me an Idea of how to tackle the problem. I ended up saving the screenshot to a file and then manually adding it to the clipboard: sh -c "gnome-screenshot -a --file=screenshot.png; xclip -selection clipboard -t image/png -i screenshot.png"
    – A. P
    Jun 15, 2022 at 22:55
  • 1
    For me as well, just calling gnome-screenshot with -a -c -f file.png doesn't copy to clipboard, although using the UI and then "Copy to Clipboard" does. @A.P's approach works great.
    – kepler
    Jun 20, 2022 at 14:45
  • 2
    I'm experiencing the same bug, but (I think) I can't use xclip as suggested by @A.P as I'm using Wayland. Fortunately, there's an xclip alternative for Wayland and it's in the official repos: wl-clipboard. So putting all together, for me what worked was: sudo apt install wl-clipboard and then the following command (which also removes the screenshot file in the end): sh -c "gnome-screenshot -a --file=temp_screenshot.png; wl-copy < temp_screenshot.png; rm temp_screenshot.png".
    – korg91
    Jun 26, 2022 at 13:17
8

You can select the part of the screen to screenshot by holding the PrtScr button.

This presents an option to select which should allow you to do a screen shot selection (which is what Ctrl+Shift+PrtScr used to do).

3
  • 1
    I know the poster wasn't looking for this answer - but it wasn't clear to me from their question that I could achieved this and I went down a rabbit hole until I discovered I could just hold down this key :)
    – Andy Smith
    Sep 14, 2022 at 20:45
  • 1
    It works, thanks!
    – A.L
    Sep 23, 2022 at 13:28
  • please upvote this answer, this is the correct way, we just need to know it.
    – Sayan Dey
    Mar 22, 2023 at 4:41
4

Just press PrtScr then define your selection and press Ctr+C to Copy the Image to your Clipboard.

4

Add this command as a custom shortcut

bash -c 'gnome-screenshot -a -c --file="$HOME/Pictures/screenshot.$(date +%Y%m%d_%H%M%S).png"'

Such as shift+alt+print

Then you can press the shortcut and select areas, file is saved in the location with timestamp -- exactly the same behavior as old Ubuntu.

1
  • This worked for me! Aug 30, 2023 at 23:35
3

I get the concern about the new PrtScr tool requiring more clicks, but playing around with a bit I found two ways to get closer to the old user experience:

  • if you use right-click to make the selection, you can click within an existing selection without problem.
  • you can use space to take the picture

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .