Thursday, May 2, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1068  / 2 Years ago, mon, july 25, 2022, 6:12:44

I am trying achieve such behavior that screenshot is saved both to the disk and to clipboard. Been digging through these questions, but it's not coming together.


What is the terminal command to take a screenshot?

What is the command line equivalent of copying a file to clipboard?


Main problem being that I can't really copy the image to the clipboard to paste it with Ctrl+V.

Is there anything else I might want to consider ?


More From » command-line

 Answers
5

I want to thank both @vanadium and @pLumo for their answers, which were very helpful, but both of used utilities have their own disadvantages and bugs at least on my system, so I finally went with combination of two approaches


#!/bin/bash

OUT_FILENAME=Screenshot from $(date "+%Y-%m-%d-%H-%M-%S").png
OUT_PATH=~/Pictures/$OUT_FILENAME

gnome-screenshot -a -f $OUT_PATH
xclip -sel clip < /dev/null
xclip -selection clip -t image/png $OUT_PATH


[#1190] Tuesday, July 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
clegian

Total Points: 283
Total Questions: 115
Total Answers: 115

Location: Morocco
Member since Tue, Feb 2, 2021
3 Years ago
;