You are browsing as a guest. Sign up (or log in) to start making projects!

PC Stats

  • 7 Devlogs
  • 38 Total hours

A program to collect and display a lot of data about the way I use my computer

Ship #1

Taken from my last devlog:
> ... I've been making an app to track information about how I use my computer, and a companion website to display the data. Right now, it logs every click, as well as the positions and dimensions of apps every 5 minutes. The dashboard website then displays that data in a variety of interesting ways.

The collection takes a long time and only works on Linux, so I'm using the dashboard as the demo. You can find the collector on the GithTub.

The most challenging part was figuring out how to collect the data, especially the clicks, however I think I spent the most time on the dashboard. It was my first time using Javascript for something complex, so I'm pretty happy with how it turned out
I hope you enjoy :)

  • 7 devlogs
  • 38h
  • 10.53x multiplier
  • 349 Stardust
Try project → See source code →
Open comments for this post

2h 5m 38s logged

FINISHED

Its finally finished! If you don’t know, I’ve been making an app to track information about how I use my computer, and a companion website to display the data. Right now, it logs every click, as well as the positions and dimensions of apps every 5 minutes. The dashboard website then displays that data in a variety of interesting ways.

The collector is now (in theory) compatible with the majority of Linux desktops (sorry Windows users, maybe next year). I also added a small config file. Right now this only stores the window-snapshot interval, which you can change through the UI. I originally planned on adding a list of apps to ignore, but there were too many problems. Primarily, I wasn’t sure how to reliably handle the focused app being blocked without making it null, which is very messy, and the whole thing seemed too complicated for a feature I’m don’t really plan on using. I also considered making it a frontend filter, but chose not to for a similar reason.

Once again, you can try it yourself here with my data. If you want to collect your own data, you can download the collector here (note: you need to give your user input permissions for this to detect clicks, more details in the README).

I’ve only tested this on my machine (KDE Wayland) so if you have a different setup, tell me how it goes!

Afterword

I had a lot of fun making this. This was my deepest dive into web development yet and I learned so much. This is also the first time I’ve shipped a project for public use, which was a has been a valuable experience. I could definitely do more with this (more config, more charts, more data), and I do plan on revisiting it in the future, but I think this is a good place to leave it for now. Thanks for reading, see you next project :)

0
0
34
Open comments for this post

15h 16m 47s logged

Day ?? - New Features!

After 15 hours (got a bit carried away) the next feature is (mostly) finished! You can now monitor and display window data. Every 5 minutes, the collector logs what apps are open and their positions on screen, which you can then visualize on the dashboard.
I thought it would be interesting to combine the click data and the window data in some way, but I decided against it. The reason being that I technically don’t know what app the user clicked since it could have changed in the 5 minutes.
To collect the data I had to run a separate KWin script to get around the restrictions, same as with the clicks. This script gave me the windows as JSON, which I then stored in 2 SQLite tables. One containing general info (one entry per snapshot), and the other containing info about specific windows.

The second major change is the collector’s new UI. It was a relatively small addition, but it makes the whole experience a lot smoother. It also uses the same UI library I was already using to get the monitor configuration which was nice.

Finally, the dashboard now stores the database in cache so everything is preserved when you reload. This change was mostly for me, because having to re-upload the file every time I changed the code got really annoying.

What’s Next

There’s a few finishing touches I need to add before shipping, Specifically:

  • Compatibility (KDE only right now)
  • Config options (Snapshot frequency, apps to ignore, etc)
  • Possibly more window features

yap

I definitely could have done all this way faster but I spent a lot of time fiddling, trying to fully understand everything. Now between the KWin scripts and the dashboard I have a much deeper understanding of Javascript than before which will help in the future. Hopefully I can ship this today or tomorrow so I can start working on my next project

2
0
17
Open comments for this post

6h 46m 28s logged

Days 5 + 6?

Changes

I added filters for time and button type to make it more interactive. I also added new charts, specifically pie charts for button and monitor usage, and bar charts for hourly and daily activity. I used chart.js to make the charts, because it makes the programming way simpler while still giving me full control. The final change was reworking the heatmap again. instead of each click being an individual element, they’re now drawn on a canvas which boosts performance significantly.

Try it!

What’s Next

Now that the dashboard is mostly finished. I want to add some quality of life things (namely caching the database so I don’t have to reupload it every time) before adding the next feature. Speaking of, the next feature is going to track what applications are open at what times, which I think will make for some really interesting data.

2
0
46
Open comments for this post

5h 38m 10s logged

Day 4 - Cleanup

Changes

Cleaned up the UI a lot. I like the new heatmap visualization a lot, but it’s a bit slow so I’ll continue to experiment with it.
I optimized the backend a lot, it used to block a full CPU core but now it sleeps properly when idling.
I also expanded compatibility to other Linux environments. This was actually way simpler than I expected, I just happened to start with KDE which is really complex for some reason.

Notes

The dashboard is now live on my website, which you can test with this sample data.
My aim right now is to get the project ship-ready, and then add features one by one.

1
0
9
Open comments for this post

3h 18m 6s logged

Day 3 - Dashboard

Today I started making the dashboard, to present the data. I decided to make it a website and have the user upload their data. This makes demoing a lot easier, as well as being good for compatibility. Right now it’s a very bare bones prototype with only a heatmap, but all the set up for reading the data should be finished, which means I can focus on polishing the UI and adding features.

I also fixed some bugs in the backend. Previously the code would fail if your mouse disconnected, but now it can handle disconnects and reconnects, as well as detect multiple mice at the same time.

0
0
19
Open comments for this post

3h 2m 58s logged

Day 2

Continuing work on my data collection project. Yesterday finished the core of the first feature — a click heatmap. Today was mostly polish and fixing the structure to make shipping easier when the time comes.

Changes

Organisation

Instead of having everything in one big ugly python file, I created a module and separated all each part into it’s own file. This will make things much easier as I continue to add new features.
As well as organising the python code, the project uses a JavaScript script to get the position of the mouse, and a bash script to run it. Neither of these can be packaged, so I updated the code to generate the JS file in the user’s share directory and run it directly from python.

Compatibility

The original code was highly specific to my setup, and couldn’t be shipped. The fix came in two parts.

  • I previously had my exact model of mouse hard-coded, so I added the ability to detect what mouse the user has
  • The code only worked for my specific Window Manager. This is still the case, but I added the structure to detect the WM and adjust for it. I plan on adding support for other’s in the coming days

Storage

All data is now stored persistently in an SQLite database. In the future this will be read and displayed by the dashboard program.

What’s Next

  • Create the dashboard to start displaying data
  • Expand compatibility to other Linux systems (might take a while)
0
0
3
Open comments for this post

2h 14m 33s logged

Day 1

Making an app to track a bunch of data about how i use my computer. Currently trying to make a heatmap of where i click the most. No UI yet because getting the mouse position on Wayland took wayyy too long to figure out

1
0
56

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…