How do I count the clicks of the mouse buttons since the start of Ubuntu?
I would like to do mouse button clicks stats so I need it.
Open a Terminal, and type:
You'll get a nice list of pointers, keyboard buttons, etc., like this excerpt from mine:
My USB mouse is right at the second line, and you see that its ID is 10. Locate your mouse in the list and note its ID, you'll need it for the main command for what you want.
If you want to check if you got the right ID, run
When you finally found the correct id, run this command:
Copy the above as it is and paste it. Before you hit ENTER, replace <id> with that id you found. When you run it, you let it there while you proceed with using the system. Anytime you want to check how many clicks were registered, you just take a look at the terminal.
Some important comments:
The approach I've used:
You can use evtest provided by the linux-input project.
But you must be sure to have CONFIG_INPUT_EVBUG=y in the kernel (probably the default if you install the debug version) and set the debug level to 8
At this point, from the console, you will see several messages, that you can parse.
You can then install the bitbake and evtest packages
Then you can use evtest against your device, you will need some tests to find out the right event you need and you can count the occurrence of that event.
Otherwise, if you want to count just the click since you logged in GDM/XDM, you can develop or ask someone to do it, an application using GTK, or Qt or wxWidgets, Enlightenment, or whatever you like, to monitor mouse events and start this application as soon as the desktopm comes up.
Though not totally what you want, WhatPulse is something nice to keep track of various titbits like that + an online ranking with teams, countries, ...
OK, I wrote a Python program to counts clicks. It runs as a daemon and saves data to the sqlite3 database. This is my first program in Python, so it may contain bugs.