3

I need exactly this one but on Linux:

Anyone know of a way to simply paste a screenshot (taken with PrtScn or Alt+PrtScn) into a Windows Explorer folder and have it be saved as an image (possibly with a dialog asking about image size and format options)? That is, I might take a screenshot with print screen, open a folder and hit Ctrl+V, and a new jpg (or png, or whatever) would appear in that folder with the contents of my screenshot.

ceremcem
  • 2,351

2 Answers2

2

You could write a small script using zenity, xclip and convert.

Start with this, but note that it is yet very basic, and will overwrite clip.png whenever you run it:

#!/bin/bash
size=$(zenity --list --title "Select target size" --column=size original 2560 1920 1280 640)
if [ size = original ]; then
    xclip -selection c -o -t image/png > clip.png
else
    xclip -selection c -o -t image/png | convert -resize $size\> - clip.png
fi

For integration with your file-manager, you could check nautilus-actions or alike.

pLumo
  • 22,565
1
  1. Install xclip and xdotools

    sudo apt install xclip xdotools
    
  2. Create an executable file, place it wherever you want with the following content:

    #!/bin/bash
    

    xdotool key ctrl+r xdotool key ctrl+l xdotool key ctrl+c xdotool key 0xff1b

    dir=$(xclip -selection clipboard -o)

    here the path to your Images folder

    img_dir="/home/user/Images/" img=$(ls -t "$img_dir" | head -n 1) cp "$img_dir$img" "$dir/$img"

  3. Create a keyboard shortcut for the file.

  4. Press the screen print key. Then press your shortcut.


Tested on Ubuntu 20.04 with Nautilus, Nemo and Thunar.