I have written a script that watches for activity on the keyboard, even if the script is running in the background, and takes actions based on those events. However, I need to pause this at times, and when it resumes, I need it to not take action on the keypresses that happened during the pause. Here is my code:
xinput test-xi2 --root 3| grep -A2 --line-buffered RawKeyRelease | while read -r line ;
do
done
Currently, when I resume the process, it immediately takes action for all of the keyboard events that happened during the pause. How can I dump these buffered keypresses?
Thanks!