Is there a way to screenshot specific windows in bash, in such a way that if it's unfocused it will still screenshot it?
sleep 10
while true;
do
scrot ~/Screenshots/"$(date +"%d-%m-%Y_%H:%M:%S").png"
play ~/.custom-stuff/pew.mp3 vol 0.2 > /dev/null 2>&1
echo Shot time: $(date +"%d-%m-%Y_%H:%M:%S")
sleep 30
done
I want to create a time-lapse video of a specific program (game).
Maybe import -window id
could be used instead of scrot
? But I still don't understand how it works...
I am not 100% sure if this would work in every DE, but in mine seems to work.
What I did was to run the following line in a terminal:
import -window $(xdotool getwindowfocus) -pause 5 asd.png & for i in {1..6}; do echo $i; sleep 1; done
Then switched to another window and waited for 10 seconds and I could see the image:
Of course, you can first get the window ID by running xdotool
in your desired window then adapt the bash command accordingly.