It's late.

x11 mouse events can be found with xinput

# find the Virtual core pointer
mouse=$(xinput list |grep 'Virtual core pointer' |awk ' { print $5 }'|cut -d= -f2)
xinput --test-xi2 --root $mouse| grep --line-buffered -A2 "EVENT type 15" |grep --line-buffered detail


# lets count 
mouse=$(xinput list |grep 'Virtual core pointer' |awk ' { print $5 }'|cut -d= -f2)
xinput --test-xi2 --root $mouse| grep --line-buffered -A2 "EVENT type 15" |grep --line-buffered detail|while read file; do ((count++));     echo $count;       done

Copyright 2024 Nicholas.A.Schembri