How to use `scrot` to take screenshots of a particular window by name?
From man scrot
:
-u, --focused
Use the currently focused window.
So you could just change your script like so:
#!/bin/sh
while true
do
scrot -u "$(date)".jpg
sleep 5
done
However this will start taking screenshots as soon as the script is started, which is probably undesired; this would be a bit more user-friendly, as it will start taking screenshots only after the user has manually selected a window:
#!/bin/sh
scrot -s "$(date)".jpg
while true
do
sleep 5
scrot -u "$(date)".jpg
done