All credits go to
jishjib22kys from reddit
Here is a solution he made
So out of curiosity I did this. Save it to a file WITH JUST ALPHANUMERIC CHARACTERS IN THE FILE NAME, because I was lazy and it explodes in your face otherwise. Then execute it in a terminal preceeding your file name with " bash " and a space:
#! /bin/bash
capdir="/tmp/$(basename $0)/$USER/$(date +%F_%H-%M-%S)_$$";
mkdir -p $capdir;
cd $capdir || (echo ERROR; exit 1);
declare -i i;
(
for inputId in $(xinput --list |egrep -o 'id=[[:digit:]]+[[:space:]]+\[slave'|egrep -o '[[:digit:]]+'); do
xinput test $inputId &
done
# couldn't find an event for when painting has finished
# /usr/bin/xev -root & # egrep --line-buffered 'release|Configure|Unmap.+synthetic YES'
wait %+;
)|fgrep --line-buffered 'release'|while read -r event; do
timestamp="$(date +%F--%H-%M-%S)";
if [[ "$lasttimestamp" == "$timestamp" ]]; then
i+=1;
else
i=0;
lasttimestamp="$timestamp";
fi
# -quality ?
#activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)");
#activeWinId=${activeWinLine:40};
#if [[ -n "$activeWinId" ]]; then
# import -window "$activeWinId" -frame -border "png:$timestamp_$i.png";
#fi
#echo "#$event#";
sleep 0.1; # small delay so things can be painted
import -window root "png:$timestamp--$i.png";
#echo "#done#";
done
It captures the whole screen 100ms after each key or mouse button release and saves it in /tmp/.../.../.../*.png . Maybe we should put it on github, but I don't think it's worth for just one file. During development, I called the file " scapper ".
// edit
It needs xinput and imagemagick , both probably available in all repos of all distros.
You can find more details at original reddit post
here