Introduction: How Many Times Have You Pressed Your Keyboard?
So I thought it would be fun to get an overview of how many keypresses I make doing a day. And which keys I use the most. So I created this little piece of software (Mac only).
Step 1: Getting the Software From GitHub
All the code I've created is available on GitHub at: https://github.com/natlampen/keyusage
The 4 files have the following purpose
main.c - Is the logger software
makefile - Is the build file for main.c
create_db.sh - Is a bash_script used to create the database for storage of keypresses.
grapher.py - Is the script that interacts with plotly. Plotting the results.
Step 2: Compiling and Running the Software
So its time to compile the logger software. For this to work you need GCC and make, both applications are available through MacPorts or Homebrew.
The step of compiling is:
1. Open a terminal
2. cd into the the directory of the downloaded files
3. type 'make' - This compiles the file
4. type './create_db.sh' - This creates the database for logging
5. type 'sudo ./logger' - This starts the logger. Depending on your settings you will be asked for your password
At the moment the logger has to be started manually every time you boot your computer.
Step 3: Plotting the Data
After the software has run for some time it is time to plot the data. For this to work you need an account with https://plot.ly. Also you will need the plotly python package.
Install the plotly python package:
1. Open a terminal
2. Type pip install plotly.
Plotting the data:
1. Open the grapher.py with a text-editor and edit the data according to your login-information:
username = "Your_username"
api_key = "Your_apikey"
2. Save the script.
3. Run the script, type './grapher.py' in your terminal
Now you have an overview of your keypresses. Below is a plot of my data
We have a be nice policy.
Please be positive and constructive.