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

Bash - Linux raw mouse events bash click xinput (last edited 2016-03-02 05:13:28 by localhost)