20

When taking a screen shot in Ubuntu 22.04 using the PrtSc key, the image is always saved in the ~/Pictures/Screenshots/ directory. However, I generally almost always paste that image to another application and I do not want it to be saved as a file. Besides of filling this directory with unneeded files, I do not want some confidential screen shot information to go to the file system in the first place.

Please note that I am talking about the new "internal" screen shot feature of GNOME 42.x which is activated using the PrtSc key and not the old Screenshot application (gnome-screenshot).

Is there any hidden option to disable or at least change the destination directory? If not, I will have to switch to the old applications like gnome-screenshot or flameshot.

FedKad
  • 13,420

6 Answers6

16

It seems to work for me if I symlink the screenshot directory to /dev/null:

mv ~/Pictures/Screenshots ~/Pictures/Screenshots.old
ln -s /dev/null ~/Pictures/Screenshots

If I do that, the notification that the screenshot is available in the clipboard is not shown anymore. However, the screenshot is still in the clipboard.

3

You can map printscreen (or any key combo) to this utility called xfce4-screenshooter - you can use it even if you don't use xfce desktop. By default it will ask you what to capture (entire screen, active window, select region etc) and by default it will ask you what to do with the screenshot (save to disk, copy to clipboard etc) but you can add switches to the command that gets executed when you press printscreen. For example, "xfce4-screenshooter -c -f" will take a full screen shot and copy it to the clipboard.

In the mint repositories the package is called xfce4-screenshooter, i'm suspecting it will be the same in all ubuntu variants.

dolt
  • 375
2

As an alternative to xfce4-screenshooter I could recomment Flameshot. It has lots of "bells-and-whistles", and for me the most useful the ability to finetune the area I wish to copy.

Gungne
  • 21
  • 3
1

Flameshot and xfce4 were not working for me, so after some digging here is what I came up with. From the gnome discussion, here is a simple code that will copy screenshots to clipboard without saving.

While creating a custom keyboard shortcut in settings, add the following code in Command section:

bash -c "gnome-screenshot -af ~/Pictures/Screenshots/_custom_screenshot && xclip ~/Pictures/Screenshots/_custom_screenshot -selection clipboard -target image/png; rm ~/Pictures/Screenshots/_custom_screenshot"

Make sure you have gnome-screenshot and xclip installed.

Dhruv
  • 163
1

Here is the perfect solution for this: https://forum.zorin.com/t/take-area-screenshot-without-saving-in-disk-in-gnome-screenshot/43996/11?u=sh_fahim

basically add this command as your custom keyboard shortcut and you're good to go: bash -c 'gnome-screenshot -af "$XDG_RUNTIME_DIR"/_custom_screenshot && xclip "$XDG_RUNTIME_DIR"/_custom_screenshot -selection clipboard -target image/png; rm "$XDG_RUNTIME_DIR"/_custom_screenshot'

0

Another solution, if you don't want a Pictures directory either, is to set XDG_PICTURES_DIR="/tmp" or XDG_PICTURES_DIR="/dev/null" in ~/.config/user-dirs.dirs, since the Screenshots directory is created within the Pictures one.

spelufo
  • 103